Re: bitmap_heap_scan vs sequential scan

From: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "'Mark Steben *EXTERN*'" <mark(dot)steben(at)drivedominion(dot)com>, pgsql-admin <pgsql-admin(at)postgresql(dot)org>
Subject: Re: bitmap_heap_scan vs sequential scan
Date: 2015-09-25 08:43:52
Message-ID: A737B7A37273E048B164557ADEF4A58B50FAF3FE@ntex2010i.host.magwien.gv.at
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Vladimir Borodin 2015-09-26 18:10:30 Getting SQL commands from WALs
Previous Message Scott Mead 2015-09-24 20:25:29 Re: Query on Postgres locks