sql - What can justify a long running EXPLAIN on query (postgres)? -


i'm opposed today new kind of query optimising problem.

my query :

select *  sanrss  left join sanrum  on sanrum.sanrum___rforefide = sanrss.sanrss___rforefide ,     sanrum.sanrum___rfovsnide = sanrss.sanrss___rfovsnide , sanrum.sanrum___sanrsside = sanrss.sanrsside left join sanact  on sanact.sanact___rforefide = sanrum.sanrum___rforefide , sanact.sanact___rfovsnide = sanrum.sanrum___rfovsnide , sanact.sanact___sanrsside = sanrum.sanrum___sanrsside , sanact.sanact___sanrumide = sanrum.sanrumide , sanact.sanact___sanrumide   not null , sanact.sanact___rsanopide='ccam' inner join saneds  on sanrss.sanrss___rforefide = saneds.saneds___rforefide , sanrss.sanrss___rfovsnide = saneds.saneds___rfovsnide , sanrss.sanrss___sanedside = saneds.sanedside inner join sandia on (sandia___rforefide, sandia___rfovsnide, sandia___sanrsside, sandia___sanrumide, sandiasig) = (sanrum___rforefide, sanrum___rfovsnide, sanrum___sanrsside, sanrumide, 1) inner join rsaidp  on saneds.saneds___rforefide = rsaidp.rsaidp___rforefide , saneds.saneds___rsaidpide = rsaidp.rsaidpide   sanrss.sanrss___rforefide =  'chul'  , sanrss.sanrss___rfovsnide =  '201303_prov'  , sanrss.sanrssdtf >=  '2013-01-01 00:00:00.0'  , sanrss.sanrssdtf <=  '2013-03-31 23:59:59.999'   , sanrss.sanrsside = '7801512'  

this not * 300 fields selected.

it slow in 1 of our server not in other, run explain on determine execution plan, 1 give me total runtime of 0.5 ms !!! real total working time of explain analyze 3.6 seconds.

so tried prepare request, it's point realize calculation of query plan cause of huge delay.

i tried switch session parameter of geqo (effort 1, effort 10, geqo desactivation), no effect on execution time. after stats calculation on table of query, calculation time dropped 2.4 seconds.

the strange point on slower server (same cpu , motherboard, no ssd storage), exact same query same parameters took 15 ms determine query plan , execute. main difference between 2 servers amount of data, there twice data in 1 problem in tables.

so should consider understand slowing execution plan calculation ?

it looks have define large global statistics target. valus link time necessary define query plan.

lowering value has resolve our problem.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -