strange

From: Szymon Guz <mabewlun(at)gmail(dot)com>
To: PostgreSQL <pgsql-general(at)postgresql(dot)org>
Subject: strange
Date: 2010-03-21 21:05:29
Message-ID: e4edc9361003211405q72ecee8l58b1f5f125494dd9@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,
I've got a simple query. When I use explain analyze it lasts 7 times slower.
Why?

test_counters=# SELECT COUNT(*), xtype FROM test GROUP BY xtype ORDER BY
xtype;
count | xtype
---------+-------
669000 | A
84000 | B
63000 | D
15000 | E
159000 | G
7866000 | H
1000000 | N
144000 | NI
(8 rows)

Time: 3343,376 ms
test_counters=# EXPLAIN ANALYZE SELECT COUNT(*), xtype FROM test GROUP BY
xtype ORDER BY xtype;
QUERY PLAN

---------------------------------------------------------------------------------------------------------------------------------
Sort (cost=243136.22..243136.24 rows=8 width=2) (actual
time=24306.075..24306.083 rows=8 loops=1)
Sort Key: xtype
Sort Method: quicksort Memory: 25kB
-> HashAggregate (cost=243136.00..243136.10 rows=8 width=2) (actual
time=24306.030..24306.038 rows=8 loops=1)
-> Seq Scan on test (cost=0.00..193136.00 rows=10000000 width=2)
(actual time=0.013..11365.414 rows=10000000 loops=1)
Total runtime: 24306.173 ms
(6 rows)

Time: 24306,944 ms

regards
Szymon

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Cédric MOULLET 2010-03-21 21:19:30 Full Text Search: howto manage multiple languages ?
Previous Message Scott Marlowe 2010-03-21 20:29:30 Re: Transaction table