Re: [PERFORM] Confirmation of bad query plan generated by 7.4 tree

2006-06-13 Thread Tom Lane
"Shaun Thomas" <[EMAIL PROTECTED]> writes: > Simply changing: > now() - interval '2 days' > to > '2006-06-11 15:30:00' > generated a much more accurate set of estimates. Yeah, 7.4 won't risk basing estimates on the results of non-immutable functions. We relaxed that in 8.0 I believe.

Re: [PERFORM] Confirmation of bad query plan generated by 7.4 tree

2006-06-13 Thread Marcin Mank
> warehouse-# WHERE e.event_date > now() - interval '2 days' Try explicitly querying: WHERE e.event_date > '2006-06-11 20:15:00' In my understanding 7.4 does not precalculate this timestamp value for the purpose of choosing a plan. Greetings Marcin ---(end of broadc

Re: [PERFORM] Confirmation of bad query plan generated by 7.4 tree

2006-06-13 Thread Tom Lane
"Shaun Thomas" <[EMAIL PROTECTED]> writes: > Am I correct in assuming this terrible plan is due to our ancient > version of Postgres? I missed the part where you explain why you think this plan is terrible? 412ms for what seems a rather expensive query doesn't sound so awful. Do you know an altern

[PERFORM] Confirmation of bad query plan generated by 7.4 tree

2006-06-13 Thread Shaun Thomas
Just so I don't think I'm insane: warehouse=# explain analyzeselect e.event_date::date warehouse-# from l_event_log e warehouse-# JOIN c_event_type t ON (t.id = e.event_type_id) warehouse-# WHERE e.event_date > now() - interval '2 days' warehouse-# AND t.event_name = 'activ