Re: Query Analyzing - Mailing list pgsql-general

From Manfred Koizar
Subject Re: Query Analyzing
Date
Msg-id i8t7iu0t3djti5pnpft8hbfm5v1dkkbtc2@4ax.com
Whole thread Raw
In response to Query Analyzing  ("Booth, Robert" <Robert_Booth@intuit.com>)
List pgsql-general
On Wed, 3 Jul 2002 11:02:00 -0700, "Booth, Robert"
<Robert_Booth@intuit.com> wrote:
>In looking at this I see that my index on the grdb table is getting used,
>but all of the other tables are being sequentially scanned.  All of the
>joins are being done on primary key fields but they are all getting
>sequentially scanned, is there something that I'm missing?

Robert,

if you have not yet VACUUM ANALYZEd your db, now's the time to do it.

If you are on v7.2.x, use EXPLAIN ANALYZE;  it gives you not only the
estimated times and row counts, but also the actual numbers.

And finally, a sequential scan is not a bad thing per se.  If a large
fraction of the rows are to be fetched and if these rows are spread
all over the table, a sequential scan is faster than going through an
index and then again ending up reading (almost) all pages.

>  Seq Scan on users lr  (cost=0.00..7.81 rows=281 width=26)

How many rows are in users?  How many of them match your join
criteria?

Servus
 Manfred



pgsql-general by date:

Previous
From: Manfred Koizar
Date:
Subject: Re: One source of constant annoyance identified
Next
From: Curt Sampson
Date:
Subject: Re: recursing down a tree