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

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Reply via email to