Why would a scan take so long?

From: Michal Politowski <mpol+pg(at)meep(dot)pl>
To: pgsql-general(at)postgresql(dot)org
Subject: Why would a scan take so long?
Date: 2010-10-01 15:13:58
Message-ID: 20101001151358.GA12255@meep.pl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

EXPLAIN SELECT count(DISTINCT catalog.id) FROM catalog WHERE flag=false;
QUERY PLAN
-----------------------------------------------------------------------------------------
Aggregate (cost=1615927.27..1615927.28 rows=1 width=8)
-> Seq Scan on catalog (cost=0.00..1603214.56 rows=5085084 width=8)
Filter: (NOT flag)

SELECT pg_size_pretty(pg_relation_size('catalog'));
pg_size_pretty
----------------
9380 MB

Nothing else is going on the system, during the query disk reads rise from
around 0 to > 100MB/s, so I would assume it should take a couple minutes
and it takes ten times longer:
Time: 1495549.716 ms

What am I missing?

--
Michal Politowski

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dr. Peter Voigt 2010-10-01 15:15:35 Re: PostgreSQL 9.0 (x86-64) and Windows 7 (x86-64) - Unable to install
Previous Message Alexander Farber 2010-10-01 15:11:47 Re: Copying a column into a temp. table