Bug#48582: psql spends hours computing results it already knows (fwd) - Mailing list pgsql-hackers

From Oliver Elphick
Subject Bug#48582: psql spends hours computing results it already knows (fwd)
Date
Msg-id 199910281953.UAA31930@linda.lfix.co.uk
Whole thread Raw
Responses Re: [HACKERS] Bug#48582: psql spends hours computing results it already knows (fwd)  ("Ross J. Reedstrom" <reedstrm@wallace.ece.rice.edu>)
List pgsql-hackers
This is a Debian bug report, which needs upstream attention.

------- Forwarded Message

Date:    Thu, 28 Oct 1999 13:45:18 -0400
From:    Brian Ristuccia <brianr@osiris.978.org>
To:      submit@bugs.debian.org
Subject: Bug#48582: psql spends hours computing results it already knows

Package: postgresql
Version: 6.5.2-3

massive_db=> explain select count(*) from huge_table;
NOTICE:  QUERY PLAN:

Aggregate  (cost=511.46 rows=9923 width=12) ->  Seq Scan on huge_table  (cost=511.46 rows=9923 width=12)

EXPLAIN

If huge_table really is huge -- like 9,000,000 rows instead of 9923, after
postgresql already knows the number of rows (that's how it determines the
cost), it proceeds to do a very long and CPU/IO intensive seq scan to
determine the count().

- -- 
Brian Ristuccia
brianr@osiris.978.org
bristucc@nortelnetworks.com
bristucc@cs.uml.edu


------- End of Forwarded Message


--      Vote against SPAM: http://www.politik-digital.de/spam/                ========================================
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver              PGP key from public servers; key
ID32B8FAA1                ========================================    "Cast thy burden upon the LORD, and he shall
sustain     thee; he shall never allow the righteous to fall."                                                Psalms
55:22
 




pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: [HACKERS] psql Week 4.142857
Next
From: "Ross J. Reedstrom"
Date:
Subject: Re: [HACKERS] Bug#48582: psql spends hours computing results it already knows (fwd)