From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com> |
Cc: | Greg Stark <gsstark(at)mit(dot)edu>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: slow count in window query |
Date: | 2009-07-17 04:12:39 |
Message-ID: | 162867790907162112j6bf48e92wdcc0934ae2e1fc39@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hello
look on:
postgres=# explain select count(*) over () from x;
QUERY PLAN
-------------------------------------------------------------
WindowAgg (cost=0.00..265.00 rows=10000 width=0)
-> Seq Scan on x (cost=0.00..140.00 rows=10000 width=0)
(2 rows)
Time: 1,473 ms
postgres=# explain select count(*) over (order by a) from x;
QUERY PLAN
------------------------------------------------------------------------
WindowAgg (cost=0.00..556.25 rows=10000 width=4)
-> Index Scan using gg on x (cost=0.00..406.25 rows=10000 width=4)
(2 rows)
but
query1: 160ms
query2: 72ms
regards
Pavel Stehule
From | Date | Subject | |
---|---|---|---|
Next Message | KaiGai Kohei | 2009-07-17 04:30:00 | Re: [PATCH] SE-PgSQL/tiny rev.2193 |
Previous Message | Itagaki Takahiro | 2009-07-17 03:56:29 | Re: COPY WITH CSV FORCE QUOTE * -- REVIEW |