Bug#48582: psql spends hours computing results it already knows (fwd)

From: "Oliver Elphick" <olly(at)lfix(dot)co(dot)uk>
To: pgsql-hackers(at)postgresql(dot)org
Cc: Brian Ristuccia <brianr(at)osiris(dot)978(dot)org>, 48582(at)bugs(dot)debian(dot)org
Subject: Bug#48582: psql spends hours computing results it already knows (fwd)
Date: 1999-10-28 19:53:31
Message-ID: 199910281953.UAA31930@linda.lfix.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)osiris(dot)978(dot)org>
To: submit(at)bugs(dot)debian(dot)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(at)osiris(dot)978(dot)org
bristucc(at)nortelnetworks(dot)com
bristucc(at)cs(dot)uml(dot)edu

------- End of Forwarded Message

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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ross J. Reedstrom 1999-10-28 20:32:17 Re: [HACKERS] Bug#48582: psql spends hours computing results it already knows (fwd)
Previous Message Peter Eisentraut 1999-10-28 16:46:39 Re: [HACKERS] psql Week 4.142857