Re: Creating Index - Mailing list pgsql-sql

From Peter Eisentraut
Subject Re: Creating Index
Date
Msg-id Pine.LNX.4.44.0310011419060.2932-100000@peter.localdomain
Whole thread Raw
In response to Creating Index  ("CN" <cnliou9@fastmail.fm>)
Responses Re: Creating Index  ("CN" <cnliou9@fastmail.fm>)
List pgsql-sql
CN writes:

> Table1 contains 9000 rows and table2 contains 0 row. This query, which
> takes 13489 msec, is extremely slow as pgsql sequentially scans all rows
> in table1:
>
> EXPLAIN ANALYZE SELECT COUNT(*) FROM view1;

Unqualified count() cannot use an index because it has to visit all the
rows in the table.  Then again, I don't quite believe that visiting 9000
rows takes 13 seconds.  Can you show us the result of EXPLAIN ANALYZE and
your real table and view definitions, because the ones you showed
contained a few syntax errors.

-- 
Peter Eisentraut   peter_e@gmx.net



pgsql-sql by date:

Previous
From: "CN"
Date:
Subject: Creating Index
Next
From: Tom Lane
Date:
Subject: Re: Determining Inheritance