Обсуждение: Explain returns extremely high cost
Hi!
I have a database just recreated from scratch with SQL script.
(My PostgreSQL version is 8.1.3).
All of the tables are pretty empty, but that's what I've got with explain:
EXPLAIN SELECT * FROM account;
QUERY PLAN
------------------------------------------------------------------------
Seq Scan on account (cost=100000000.00..100000001.05 rows=5 width=41)
This is what I have in the table:
SELECT * FROM account;
obj_id | login | password | client_id | service_id | type_id | state_id
---------+---------+-------------+-----------+------------+---------+----------
1000513 | root | _system____ | 1000471 | 1000486 | 1000113 | 1000209
1000548 | root | _system____ | 1000472 | 1000536 | 1000113 | 1000209
1000550 | root | _system____ | 1000475 | 1000534 | 1000113 | 1000209
1000552 | sol | _sol | 1000472 | 1000536 | 1000113 | 1000209
1000554 | seregik | _seregik | 1000475 | 1000534 | 1000113 | 1000209
(5 rows)
Time: 1.346 ms
For other tables I have more or less the same high costs.
I've done VACUUM ANALYZE. This is what I have in pg_class table:
SELECT relpages,reltuples FROM pg_class WHERE relname='account';
relpages | reltuples
----------+-----------
1 | 5
Why the costs are so high? Is it a bug?
Thanks in advance for any suggestions!
Regards, Andrii
On Tue, Aug 15, 2006 at 10:14:49AM +0300, Andrii Vasyliev wrote: > Hi! > > I have a database just recreated from scratch with SQL script. > (My PostgreSQL version is 8.1.3). > All of the tables are pretty empty, but that's what I've got with explain: > > EXPLAIN SELECT * FROM account; > QUERY PLAN > ------------------------------------------------------------------------ > Seq Scan on account (cost=100000000.00..100000001.05 rows=5 width=41) Looks like someone did an "enable_seqscan=no" somewhere, do a "show all" and check the planner variables... Have a nice day, -- Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/ > From each according to his ability. To each according to his ability to litigate.