Re: Seq Scan - Mailing list pgsql-general

From Joshua D. Drake
Subject Re: Seq Scan
Date
Msg-id 46605131.8060101@commandprompt.com
Whole thread Raw
In response to Seq Scan  ("Tyler Durden" <tylersticky@gmail.com>)
Responses Re: Seq Scan  ("Tyler Durden" <tylersticky@gmail.com>)
List pgsql-general
Tyler Durden wrote:
> Hi,
> I'm having some problems in performance in a simple select count(id)
> from.... I have 700 000 records in one table, and when I do:
>
> # explain select (id) from table_name;
> -[ RECORD 1
> ]----------------------------------------------------------------
> QUERY PLAN | Seq Scan on table_name  (cost=0.00..8601.30 rows=266730
> width=4)
>
> I had created an index for id(btree), but still shows "Seq Scan".
> What I'm doing wrong?

Nothing. You have to scan the table because you aren't giving postgresql
anything to use the index by.

Joshua D. Drake

>
> Thanks,
> Tyler
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend
>


--

       === The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive  PostgreSQL solutions since 1997
              http://www.commandprompt.com/

Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate
PostgreSQL Replication: http://www.commandprompt.com/products/


pgsql-general by date:

Previous
From: "John D. Burger"
Date:
Subject: Re: Seq Scan
Next
From: "Simon Riggs"
Date:
Subject: Re: warm standby server stops doingcheckpointsafterawhile