Re: Query does not return rows unless a LIMIT statement is used. - Mailing list pgsql-novice

From Tom Lane
Subject Re: Query does not return rows unless a LIMIT statement is used.
Date
Msg-id 1549.1140020515@sss.pgh.pa.us
Whole thread Raw
In response to Re: Query does not return rows unless a LIMIT statement is used.  (Richard Kut <rkut@intelerad.com>)
Responses Re: Query does not return rows unless a LIMIT statement is used.
List pgsql-novice
Richard Kut <rkut@intelerad.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

pgsql-novice by date:

Previous
From: Richard Kut
Date:
Subject: Re: Query does not return rows unless a LIMIT statement is used.
Next
From: Richard Kut
Date:
Subject: Re: Query does not return rows unless a LIMIT statement is used.