Skip site navigation (1) Skip section navigation (2)

Re: query very slow but table very small

From: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: query very slow but table very small
Date: 2008-05-27 10:16:35
Message-ID: 20080527101633.GC27604@a-kretschmer.de (view raw or flat)
Thread:
Lists: pgsql-novice
am  Tue, dem 27.05.2008, um 11:31:47 +0200 mailte Ron Arts folgendes:
> Hi,
> 
> I have a table containing 8 rows. The records are around 2k max.
> selects on this table take very long to complete:
> This is not a table that had a lot of adds/deletes, and I

How many UPDATE?


> have run vacuum and analyze.
> 
> tium=# select count(*) from trunk;
>  count
> -------
>      8
> (1 row)
> 
> (Takes about 2 seconds)

How big ist the table on disk? (pg_tablespace_size(name))


> 
> The database is lightly loaded otherwise, but I don't understand
> the explain output:
> 
> tium=# explain select count(*) from trunk;
>                           QUERY PLAN
> ---------------------------------------------------------------
>  Aggregate  (cost=65598.10..65598.11 rows=1 width=0)
>    ->  Seq Scan on trunk  (cost=0.00..65598.08 rows=8 width=0)
> (2 rows)
> 
> What does it mean that the cost figures are so high?

wild guess: many updates on the table -> many dead rows. The cost
estimate are close to the real cost, the table is big on disk.


Andreas
-- 
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID:   0x3FFF606C, privat 0x7F4584DA   http://wwwkeys.de.pgp.net

In response to

pgsql-novice by date

Next:From: Lee HachadoorianDate: 2008-05-28 18:28:05
Subject: Table and View Planning for Census Data
Previous:From: Ron ArtsDate: 2008-05-27 09:31:47
Subject: query very slow but table very small

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group