strange - Mailing list pgsql-general

From Szymon Guz
Subject strange
Date
Msg-id e4edc9361003211405q72ecee8l58b1f5f125494dd9@mail.gmail.com
Whole thread Raw
Responses Re: strange
List 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

pgsql-general by date:

Previous
From: Lew
Date:
Subject: Re: Licence
Next
From: Cédric MOULLET
Date:
Subject: Full Text Search: howto manage multiple languages ?