Re: bitmap_heap_scan vs sequential scan - Mailing list pgsql-admin

From Albe Laurenz
Subject Re: bitmap_heap_scan vs sequential scan
Date
Msg-id A737B7A37273E048B164557ADEF4A58B50FAF3FE@ntex2010i.host.magwien.gv.at
Whole thread Raw
In response to bitmap_heap_scan vs sequential scan  (Mark Steben <mark.steben@drivedominion.com>)
List pgsql-admin
Mark Steben wrote:
> I have what I think is a simple question.  Does the seq_scan column in the pg_stat_all_tables view
> include the number of  bitmap_heap_scans in its count or is it limited to sequential scans for a
> particular table?

The column "seq_scan" does not count bitmap heap scans:

test=> SELECT seq_scan, idx_scan FROM pg_stat_all_tables WHERE relname = 'local';
 seq_scan | idx_scan
----------+----------
        5 |        3
(1 row)

test=> BEGIN;
BEGIN
test=> SET LOCAL enable_seqscan=off;
SET
test=> SET LOCAL enable_indexscan=off;
SET
test=> SET LOCAL enable_indexonlyscan=off;
SET
test=> EXPLAIN (ANALYZE) SELECT * FROM local WHERE id = 1;
                                                    QUERY PLAN
-------------------------------------------------------------------------------------------------------------------
 Bitmap Heap Scan on local  (cost=4.14..8.15 rows=1 width=4) (actual time=0.018..0.019 rows=1 loops=1)
   Recheck Cond: (id = 1)
   Heap Blocks: exact=1
   ->  Bitmap Index Scan on local_pkey  (cost=0.00..4.14 rows=1 width=0) (actual time=0.012..0.012 rows=1 loops=1)
         Index Cond: (id = 1)
 Planning time: 0.069 ms
 Execution time: 0.048 ms
(7 rows)

test=> COMMIT;
COMMIT
test=> SELECT seq_scan, idx_scan FROM pg_stat_all_tables WHERE relname = 'local';
 seq_scan | idx_scan
----------+----------
        5 |        4
(1 row)

Yours,
Laurenz Albe

pgsql-admin by date:

Previous
From: Scott Mead
Date:
Subject: Re: Query on Postgres locks
Next
From: Vladimir Borodin
Date:
Subject: Getting SQL commands from WALs