Re: Query Analyzing

From: Manfred Koizar <mkoi-pg(at)aon(dot)at>
To: "Booth, Robert" <Robert_Booth(at)intuit(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Query Analyzing
Date: 2002-07-04 07:31:32
Message-ID: i8t7iu0t3djti5pnpft8hbfm5v1dkkbtc2@4ax.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 3 Jul 2002 11:02:00 -0700, "Booth, Robert"
<Robert_Booth(at)intuit(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jeff Davis 2002-07-04 09:10:01 Re: Indexing Views
Previous Message Manfred Koizar 2002-07-04 06:56:04 Re: One source of constant annoyance identified