Re: Query does not return rows unless a LIMIT statement is used.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: rkut(at)intelerad(dot)com
Cc: pgsql-novice(at)postgresql(dot)org, Mathew Kanner <Mathew(dot)Kanner(at)intelerad(dot)com>
Subject: Re: Query does not return rows unless a LIMIT statement is used.
Date: 2006-02-15 16:21:55
Message-ID: 1549.1140020515@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Richard Kut <rkut(at)intelerad(dot)com> writes:
> -> Hash (cost=49229.38..49229.38 rows=328403 width=284) (actual
> time=3342.874..3342.874 rows=328403 loops=1)
> -> Index Scan using kdx_pid on pid (cost=0.00..49229.38 rows=328403
> width=284) (actual time=0.010..2110.172 rows=328403 loops=1)

Hm, it looks like you've still got the planner's hands tied behind its
back --- specifically, I'll bet enable_seqscan = off. There's no reason
at all to use a full-table indexscan to load a hash table. Please try
it again with default planner parameter settings.

A general comment from comparing your two cases is that random_page_cost
is probably too high for the scenario you are testing, which looks to be
a case where both tables are fully cached in memory. However, before
reducing it you should ask yourself whether that's still likely to be
true in production. It's a bad idea to optimize on the basis of test
cases that are much smaller than your production scenario will be ...

regards, tom lane

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Richard Kut 2006-02-15 16:34:53 Re: Query does not return rows unless a LIMIT statement is used.
Previous Message Richard Kut 2006-02-15 16:11:36 Re: Query does not return rows unless a LIMIT statement is used.