Skip to content

Instantly share code, notes, and snippets.

@seamusabshere
Created June 15, 2017 14:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seamusabshere/b9d72132361fa598f7a431fa1bcb120f to your computer and use it in GitHub Desktop.
Save seamusabshere/b9d72132361fa598f7a431fa1bcb120f to your computer and use it in GitHub Desktop.
gin: bitmap index scan + bitmap heap scan
citus=> explain analyze SELECT COUNT(*) FROM households_fpd WHERE households_fpd.state_id IN ('13', '45') AND households_fpd.fpd ? 'rc_f736c9d1-008c-42bc-9bd7-04a3862292c0b1041c1c-2532-48f0-9a28-c040af8bde1b';
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------------------------------------------
Aggregate (cost=18033.01..18033.02 rows=1 width=8) (actual time=33570.273..33570.273 rows=1 loops=1)
-> Bitmap Heap Scan on households_fpd (cost=1857.74..18022.83 rows=4072 width=0) (actual time=3969.365..33225.859 rows=3928811 loops=1)
Recheck Cond: ((fpd ? 'rc_f736c9d1-008c-42bc-9bd7-04a3862292c0b1041c1c-2532-48f0-9a28-c040af8bde1b'::text) AND (state_id = ANY ('{13,45}'::text[])))
Heap Blocks: exact=2206936
-> Bitmap Index Scan on mar_8_h63fjjs_fpd_state (cost=0.00..1856.72 rows=4072 width=0) (actual time=2969.074..2969.074 rows=3971112 loops=1)
Index Cond: ((fpd ? 'rc_f736c9d1-008c-42bc-9bd7-04a3862292c0b1041c1c-2532-48f0-9a28-c040af8bde1b'::text) AND (state_id = ANY ('{13,45}'::text[])))
Planning time: 3.996 ms
Execution time: 33586.012 ms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment