difference in plan between 8.0 and 8.1?

From: Alan Stange <stange(at)rentec(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: difference in plan between 8.0 and 8.1?
Date: 2005-08-26 14:45:07
Message-ID: 430F2AF3.1080704@rentec.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Hello all,

I was hoping someone could explain the plan for a statement.

We have a table with a column of longs being used as an index. The
query plan in 8.0 was like this:

# explain select distinct timeseriesid from tbltimeseries where
timeseriesid > 0 order by timeseriesid;
SET
QUERY PLAN
-------------------------------------------------------------------------------------------------------
Unique (cost=0.00..15065908.60 rows=10854026 width=8)
-> Index Scan using idx_timeseris on tbltimeseries
(cost=0.00..15038773.53 rows=10854026 width=8)
Index Cond: (timeseriesid > 0)
(3 rows)

In 8.1, (using the same database after a dump+restore+vacuum+analyze) I
get the following:
# explain select distinct timeseriesid from tbltimeseries where
timeseriesid > 0 order by timeseriesid;
QUERY PLAN
---------------------------------------------------------------------------------------------------
Unique (cost=2717137.08..2771407.21 rows=10854026 width=8)
-> Sort (cost=2717137.08..2744272.14 rows=10854026 width=8)
Sort Key: timeseriesid
-> Bitmap Heap Scan on tbltimeseries
(cost=48714.09..1331000.42 rows=10854026 width=8)
Recheck Cond: (timeseriesid > 0)
-> Bitmap Index Scan on idx_timeseris
(cost=0.00..48714.09 rows=10854026 width=0)
Index Cond: (timeseriesid > 0)
(7 rows)

I'm hoping someone can explain the new query plan (as I'm not sure I
understand what it is doing).

Thanks!

-- Alan

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Merlin Moncure 2005-08-26 14:49:23 Re: Limit + group + join
Previous Message Stephan Szabo 2005-08-26 14:18:30 Re: Limit + group + join