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 why it chooses such plans. (should I be posting to pg-performance?)
Your query plans don't seem to match your queries. That makes it difficult to provide meaningful advice.
-- Richard Huxton Archonet Ltd ---------------------------(end of broadcast)--------------------------- TIP 2: Don't 'kill -9' the postmaster