Re: index and queries using '<' '>'

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Marc Boucher <pgml(at)gmx(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: index and queries using '<' '>'
Date: 2004-11-19 15:20:50
Message-ID: 20041119071650.V31302@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Fri, 19 Nov 2004, Marc Boucher wrote:

> At 16:23 18/11/2004 +0100, Martijn van Oosterhout wrote:
> > The system seems to think that a scan is cheap because the table is so
> > small.
> The table currently contains just over 10000 elements. So 238 rows is a
> small part of it.
>
> > Have you ever ANALYZEd that table?
> Yes. That and reindex (in case of a problem).
> I have also tried ALTER TABLE ALTER COLUMN SET STATISTICS, but without
> improvement.
>
> > Also, EXPLAIN ANALYZE gives a much better idea of what is going on...
> You mean ANALYZE VERBOSE ?

EXPLAIN ANALYZE is similar to EXPLAIN except that it runs the query
and gives real time per step and real row counts rather than the
estimates. It's very handy.

If random page reads are consistently less expensive than postgres
currently thinks, you may want to lower random_page_cost. EXPLAIN ANALYZE
is useful here because it lets you compare the real times versus the
estimated costs of both scan types when used with enable_seqscan=off.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2004-11-19 15:22:32 Re: index and queries using '<' '>'
Previous Message Taber, Mark 2004-11-19 15:19:55 Phantom user in db--'128'