Query Tuning Bigquery -


i have query strange behavior because in occasions takes 120 seconds , 250 seconds. have minimize execution time can not find guide me improve runtime of queries.

the table containing information has following characteristics:

  1. all fields repeat
  2. it has 800 million records
  3. process 14.2 gb

the query this:

select  todayinfo.client client,   todayinfo.todayinfo today,   todayinfo.dayagoinfo dayago,   todayinfo.threedaysago threedaysago,   todayinfo.weekago weekago, (   select     client,     sum(if( bp_time between timestamp('2016/01/01')     , timestamp('2016/01/31'),1,0)) todayinfo,     sum(if( bp_time between date_add(timestamp('2016/01/01'), - 1,"day")     , date_add(timestamp('2016/01/31'), - 1,"day"),1,0)) dayagoinfo,     sum(if( bp_time between date_add(timestamp('2016/01/01'), - 3,"day")     , date_add(timestamp('2016/01/31'), - 3,"day"),1,0)) threedaysago,     sum(if( bp_time between date_add(timestamp('2016/01/01'), - 8,"day")     , date_add(timestamp('2016/01/31'), - 8,"day"),1,0)) weekago       [dataset.table]    group     client      ) todayinfo  order     today desc limit 10 

there guide or tips can me optimize runtimes not query future queries?

because of way bigquery works, isn't tunable relational databases. not use indexes, , every query full scan.

that being said, need learn more why queries slow. depends lot on specifics of data. can use query plan explanation idea of bigquery spending time.

but, @pentium10 mentioned in comment, going have partition data day reduce size of scans. it's explained in more detail in this answer.


Comments

Popular posts from this blog

Unlimited choices in BASH case statement -

Redirect to a HTTPS version using .htaccess -

javascript - jQuery: Add class depending on URL in the best way -