From: | Dan Harris <fbsd(at)drivefaster(dot)net> |
---|---|
To: | pgsql-performance(at)postgresql(dot)org |
Subject: | Re: Seq Scan |
Date: | 2007-06-01 16:59:01 |
Message-ID: | 46605055.3070305@drivefaster.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
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?
>
> Thanks,
> Tyler
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Have you searched our list archives?
>
> http://archives.postgresql.org
select count(*) will *always* do a sequential scan, due to the MVCC
architecture. See archives for much discussion about this.
-Dan
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Glaesemann | 2007-06-01 17:03:30 | Re: Seq Scan |
Previous Message | Tyler Durden | 2007-06-01 16:48:56 | Seq Scan |