Re: [GENERAL] Poor Plan selected w/ not provided a date/time but selecting date/time from a table

2007-10-18 Thread Richard Huxton
Ow Mun Heng wrote: On Wed, 2007-10-17 at 20:37 +0100, Richard Huxton wrote: Your query plans don't seem to match your queries. That makes it difficult to provide meaningful advice. Well, then that makes both you and me(both) stumped. because the 2 queries are exactly the same except for the

Re: [GENERAL] Poor Plan selected w/ not provided a date/time but selecting date/time from a table

2007-10-18 Thread Ow Mun Heng
On Thu, 2007-10-18 at 07:28 +0100, Richard Huxton wrote: Ow Mun Heng wrote: On Wed, 2007-10-17 at 20:37 +0100, Richard Huxton wrote: Your query plans don't seem to match your queries. That makes it difficult to provide meaningful advice. Well, then that makes both you and me(both)

Re: [GENERAL] Poor Plan selected w/ not provided a date/time but selecting date/time from a table

2007-10-18 Thread Alvaro Herrera
Ow Mun Heng wrote: On Wed, 2007-10-17 at 22:47 -0300, Alvaro Herrera wrote: Ow Mun Heng wrote: Index Cond: ((audit_key_dtime = $0) AND (audit_key_dtime $1)) Index Cond: ((audit_key_dtime = '2007-08-08 18:00:00'::timestamp without time zone) AND

[GENERAL] Poor Plan selected w/ not provided a date/time but selecting date/time from a table

2007-10-17 Thread Ow Mun Heng
Query2 is way faster mainly because the plan does not choose a seq scan on a table w/ 20million rows. The only difference between Query 1 and query 2 is that the audio_key_dtime is chosen from a table rather than provided on the query. I'm not sure why this is the case and why it chooses such

Re: [GENERAL] Poor Plan selected w/ not provided a date/time but selecting date/time from a table

2007-10-17 Thread Richard Huxton
Ow Mun Heng wrote: Query2 is way faster mainly because the plan does not choose a seq scan on a table w/ 20million rows. The only difference between Query 1 and query 2 is that the audio_key_dtime is chosen from a table rather than provided on the query. I'm not sure why this is the case and

Re: [GENERAL] Poor Plan selected w/ not provided a date/time but selecting date/time from a table

2007-10-17 Thread Ow Mun Heng
On Wed, 2007-10-17 at 20:37 +0100, Richard Huxton wrote: Ow Mun Heng wrote: Query2 is way faster mainly because the plan does not choose a seq scan on a table w/ 20million rows. The only difference between Query 1 and query 2 is that the audio_key_dtime is chosen from a table rather than

Re: [GENERAL] Poor Plan selected w/ not provided a date/time but selecting date/time from a table

2007-10-17 Thread Alvaro Herrera
Ow Mun Heng wrote: Index Cond: ((audit_key_dtime = $0) AND (audit_key_dtime $1)) Index Cond: ((audit_key_dtime = '2007-08-08 18:00:00'::timestamp without time zone) AND (audit_key_dtime '2007-08-08 18:01:00'::timestamp without time zone)) This is _the_ only difference

Re: [GENERAL] Poor Plan selected w/ not provided a date/time but selecting date/time from a table

2007-10-17 Thread Ow Mun Heng
On Wed, 2007-10-17 at 22:47 -0300, Alvaro Herrera wrote: Ow Mun Heng wrote: Index Cond: ((audit_key_dtime = $0) AND (audit_key_dtime $1)) Index Cond: ((audit_key_dtime = '2007-08-08 18:00:00'::timestamp without time zone) AND (audit_key_dtime '2007-08-08