bfv_index.out 19.5 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
-- tests index filter with outer refs
drop table if exists bfv_tab1;
NOTICE:  table "bfv_tab1" does not exist, skipping
CREATE TABLE bfv_tab1 (
	unique1		int4,
	unique2		int4,
	two			int4,
	four		int4,
	ten			int4,
	twenty		int4,
	hundred		int4,
	thousand	int4,
	twothousand	int4,
	fivethous	int4,
	tenthous	int4,
	odd			int4,
	even		int4,
	stringu1	name,
	stringu2	name,
	string4		name
) distributed by (unique1);
create index bfv_tab1_idx1 on bfv_tab1 using btree(unique1);
23
explain select * from bfv_tab1, (values(147, 'RFAAAA'), (931, 'VJAAAA')) as v (i, j)
24 25 26
    WHERE bfv_tab1.unique1 = v.i and bfv_tab1.stringu1 = v.j;
                                                QUERY PLAN                                                 
-----------------------------------------------------------------------------------------------------------
27 28 29 30 31 32
 Gather Motion 3:1  (slice1; segments: 3)  (cost=0.06..278.70 rows=14 width=280)
   ->  Hash Join  (cost=0.06..278.70 rows=5 width=280)
         Hash Cond: bfv_tab1.unique1 = "*VALUES*".column1 AND bfv_tab1.stringu1::text = "*VALUES*".column2
         ->  Seq Scan on bfv_tab1  (cost=0.00..219.00 rows=3967 width=244)
         ->  Hash  (cost=0.03..0.03 rows=1 width=36)
               ->  Values Scan on "*VALUES*"  (cost=0.00..0.03 rows=1 width=36)
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175
 Optimizer status: legacy query optimizer
(7 rows)

--start_ignore
DROP TABLE IF EXISTS bfv_tab2_facttable1;
NOTICE:  table "bfv_tab2_facttable1" does not exist, skipping
DROP TABLE IF EXISTS bfv_tab2_dimdate;
NOTICE:  table "bfv_tab2_dimdate" does not exist, skipping
DROP TABLE IF EXISTS bfv_tab2_dimtabl1;
NOTICE:  table "bfv_tab2_dimtabl1" does not exist, skipping
--end_ignore
CREATE TABLE bfv_tab2_facttable1 (
col1 integer,
wk_id smallint,
id integer
)
with (appendonly=true, orientation=column, compresstype=zlib, compresslevel=5)
partition by range (wk_id) (
start (1::smallint) END (20::smallint) inclusive every (1),
default partition dflt
)
;
NOTICE:  Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'col1' as the Greenplum Database data distribution key for this table.
HINT:  The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
NOTICE:  CREATE TABLE will create partition "bfv_tab2_facttable1_1_prt_dflt" for table "bfv_tab2_facttable1"
NOTICE:  CREATE TABLE will create partition "bfv_tab2_facttable1_1_prt_2" for table "bfv_tab2_facttable1"
NOTICE:  CREATE TABLE will create partition "bfv_tab2_facttable1_1_prt_3" for table "bfv_tab2_facttable1"
NOTICE:  CREATE TABLE will create partition "bfv_tab2_facttable1_1_prt_4" for table "bfv_tab2_facttable1"
NOTICE:  CREATE TABLE will create partition "bfv_tab2_facttable1_1_prt_5" for table "bfv_tab2_facttable1"
NOTICE:  CREATE TABLE will create partition "bfv_tab2_facttable1_1_prt_6" for table "bfv_tab2_facttable1"
NOTICE:  CREATE TABLE will create partition "bfv_tab2_facttable1_1_prt_7" for table "bfv_tab2_facttable1"
NOTICE:  CREATE TABLE will create partition "bfv_tab2_facttable1_1_prt_8" for table "bfv_tab2_facttable1"
NOTICE:  CREATE TABLE will create partition "bfv_tab2_facttable1_1_prt_9" for table "bfv_tab2_facttable1"
NOTICE:  CREATE TABLE will create partition "bfv_tab2_facttable1_1_prt_10" for table "bfv_tab2_facttable1"
NOTICE:  CREATE TABLE will create partition "bfv_tab2_facttable1_1_prt_11" for table "bfv_tab2_facttable1"
NOTICE:  CREATE TABLE will create partition "bfv_tab2_facttable1_1_prt_12" for table "bfv_tab2_facttable1"
NOTICE:  CREATE TABLE will create partition "bfv_tab2_facttable1_1_prt_13" for table "bfv_tab2_facttable1"
NOTICE:  CREATE TABLE will create partition "bfv_tab2_facttable1_1_prt_14" for table "bfv_tab2_facttable1"
NOTICE:  CREATE TABLE will create partition "bfv_tab2_facttable1_1_prt_15" for table "bfv_tab2_facttable1"
NOTICE:  CREATE TABLE will create partition "bfv_tab2_facttable1_1_prt_16" for table "bfv_tab2_facttable1"
NOTICE:  CREATE TABLE will create partition "bfv_tab2_facttable1_1_prt_17" for table "bfv_tab2_facttable1"
NOTICE:  CREATE TABLE will create partition "bfv_tab2_facttable1_1_prt_18" for table "bfv_tab2_facttable1"
NOTICE:  CREATE TABLE will create partition "bfv_tab2_facttable1_1_prt_19" for table "bfv_tab2_facttable1"
NOTICE:  CREATE TABLE will create partition "bfv_tab2_facttable1_1_prt_20" for table "bfv_tab2_facttable1"
insert into bfv_tab2_facttable1 select col1, col1, col1 from (select generate_series(1,20) col1)a;
CREATE TABLE bfv_tab2_dimdate (
wk_id smallint,
col2 date
)
;
NOTICE:  Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'wk_id' as the Greenplum Database data distribution key for this table.
HINT:  The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
insert into bfv_tab2_dimdate select col1, current_date - col1 from (select generate_series(1,20,2) col1)a;
CREATE TABLE bfv_tab2_dimtabl1 (
id integer,
col2 integer
)
;
NOTICE:  Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'id' as the Greenplum Database data distribution key for this table.
HINT:  The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
insert into bfv_tab2_dimtabl1 select col1, col1 from (select generate_series(1,20,3) col1)a;
CREATE INDEX idx_bfv_tab2_facttable1 on bfv_tab2_facttable1 (id); 
NOTICE:  building index for child partition "bfv_tab2_facttable1_1_prt_dflt"
NOTICE:  building index for child partition "bfv_tab2_facttable1_1_prt_2"
NOTICE:  building index for child partition "bfv_tab2_facttable1_1_prt_3"
NOTICE:  building index for child partition "bfv_tab2_facttable1_1_prt_4"
NOTICE:  building index for child partition "bfv_tab2_facttable1_1_prt_5"
NOTICE:  building index for child partition "bfv_tab2_facttable1_1_prt_6"
NOTICE:  building index for child partition "bfv_tab2_facttable1_1_prt_7"
NOTICE:  building index for child partition "bfv_tab2_facttable1_1_prt_8"
NOTICE:  building index for child partition "bfv_tab2_facttable1_1_prt_9"
NOTICE:  building index for child partition "bfv_tab2_facttable1_1_prt_10"
NOTICE:  building index for child partition "bfv_tab2_facttable1_1_prt_11"
NOTICE:  building index for child partition "bfv_tab2_facttable1_1_prt_12"
NOTICE:  building index for child partition "bfv_tab2_facttable1_1_prt_13"
NOTICE:  building index for child partition "bfv_tab2_facttable1_1_prt_14"
NOTICE:  building index for child partition "bfv_tab2_facttable1_1_prt_15"
NOTICE:  building index for child partition "bfv_tab2_facttable1_1_prt_16"
NOTICE:  building index for child partition "bfv_tab2_facttable1_1_prt_17"
NOTICE:  building index for child partition "bfv_tab2_facttable1_1_prt_18"
NOTICE:  building index for child partition "bfv_tab2_facttable1_1_prt_19"
NOTICE:  building index for child partition "bfv_tab2_facttable1_1_prt_20"
--start_ignore
set optimizer_analyze_root_partition to on;
--end_ignore
ANALYZE bfv_tab2_facttable1;
ANALYZE bfv_tab2_dimdate;
ANALYZE bfv_tab2_dimtabl1;
SELECT count(*) 
FROM bfv_tab2_facttable1 ft, bfv_tab2_dimdate dt, bfv_tab2_dimtabl1 dt1
WHERE ft.wk_id = dt.wk_id
AND ft.id = dt1.id;
 count 
-------
     4
(1 row)

explain SELECT count(*) 
FROM bfv_tab2_facttable1 ft, bfv_tab2_dimdate dt, bfv_tab2_dimtabl1 dt1
WHERE ft.wk_id = dt.wk_id
AND ft.id = dt1.id;
                                                                 QUERY PLAN                                                                 
--------------------------------------------------------------------------------------------------------------------------------------------
 Aggregate  (cost=27.51..27.52 rows=1 width=8)
   ->  Gather Motion 3:1  (slice3; segments: 3)  (cost=27.44..27.49 rows=1 width=8)
         ->  Aggregate  (cost=27.44..27.45 rows=1 width=8)
               ->  Hash Join  (cost=6.84..27.43 rows=2 width=0)
                     Hash Cond: ft.wk_id = dt.wk_id
                     ->  Redistribute Motion 3:3  (slice2; segments: 3)  (cost=3.61..24.14 rows=3 width=2)
                           Hash Key: ft.wk_id
                           ->  Hash Join  (cost=3.61..23.99 rows=3 width=2)
                                 Hash Cond: ft.id = dt1.id
                                 ->  Append  (cost=0.00..20.20 rows=7 width=6)
                                       ->  Append-only Columnar Scan on bfv_tab2_facttable1_1_prt_dflt ft  (cost=0.00..1.00 rows=1 width=6)
                                       ->  Append-only Columnar Scan on bfv_tab2_facttable1_1_prt_2 ft  (cost=0.00..1.01 rows=1 width=6)
                                       ->  Append-only Columnar Scan on bfv_tab2_facttable1_1_prt_3 ft  (cost=0.00..1.01 rows=1 width=6)
                                       ->  Append-only Columnar Scan on bfv_tab2_facttable1_1_prt_4 ft  (cost=0.00..1.01 rows=1 width=6)
                                       ->  Append-only Columnar Scan on bfv_tab2_facttable1_1_prt_5 ft  (cost=0.00..1.01 rows=1 width=6)
                                       ->  Append-only Columnar Scan on bfv_tab2_facttable1_1_prt_6 ft  (cost=0.00..1.01 rows=1 width=6)
                                       ->  Append-only Columnar Scan on bfv_tab2_facttable1_1_prt_7 ft  (cost=0.00..1.01 rows=1 width=6)
                                       ->  Append-only Columnar Scan on bfv_tab2_facttable1_1_prt_8 ft  (cost=0.00..1.01 rows=1 width=6)
                                       ->  Append-only Columnar Scan on bfv_tab2_facttable1_1_prt_9 ft  (cost=0.00..1.01 rows=1 width=6)
                                       ->  Append-only Columnar Scan on bfv_tab2_facttable1_1_prt_10 ft  (cost=0.00..1.01 rows=1 width=6)
                                       ->  Append-only Columnar Scan on bfv_tab2_facttable1_1_prt_11 ft  (cost=0.00..1.01 rows=1 width=6)
                                       ->  Append-only Columnar Scan on bfv_tab2_facttable1_1_prt_12 ft  (cost=0.00..1.01 rows=1 width=6)
                                       ->  Append-only Columnar Scan on bfv_tab2_facttable1_1_prt_13 ft  (cost=0.00..1.01 rows=1 width=6)
                                       ->  Append-only Columnar Scan on bfv_tab2_facttable1_1_prt_14 ft  (cost=0.00..1.01 rows=1 width=6)
                                       ->  Append-only Columnar Scan on bfv_tab2_facttable1_1_prt_15 ft  (cost=0.00..1.01 rows=1 width=6)
                                       ->  Append-only Columnar Scan on bfv_tab2_facttable1_1_prt_16 ft  (cost=0.00..1.01 rows=1 width=6)
                                       ->  Append-only Columnar Scan on bfv_tab2_facttable1_1_prt_17 ft  (cost=0.00..1.01 rows=1 width=6)
                                       ->  Append-only Columnar Scan on bfv_tab2_facttable1_1_prt_18 ft  (cost=0.00..1.01 rows=1 width=6)
                                       ->  Append-only Columnar Scan on bfv_tab2_facttable1_1_prt_19 ft  (cost=0.00..1.01 rows=1 width=6)
                                       ->  Append-only Columnar Scan on bfv_tab2_facttable1_1_prt_20 ft  (cost=0.00..1.02 rows=1 width=6)
                                 ->  Hash  (cost=3.35..3.35 rows=7 width=4)
                                       ->  Broadcast Motion 3:3  (slice1; segments: 3)  (cost=0.00..3.35 rows=7 width=4)
                                             ->  Seq Scan on bfv_tab2_dimtabl1 dt1  (cost=0.00..3.07 rows=3 width=4)
                     ->  Hash  (cost=3.10..3.10 rows=4 width=2)
                           ->  Seq Scan on bfv_tab2_dimdate dt  (cost=0.00..3.10 rows=4 width=2)
 Optimizer status: legacy query optimizer
(36 rows)

-- start_ignore
create language plpythonu;
176
ERROR:  language "plpythonu" already exists
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448
-- end_ignore
create or replace function count_index_scans(explain_query text) returns int as
$$
rv = plpy.execute(explain_query)
search_text = 'Index Scan'
result = 0
for i in range(len(rv)):
    cur_line = rv[i]['QUERY PLAN']
    if search_text.lower() in cur_line.lower():
        result = result+1
return result
$$
language plpythonu;
DROP TABLE bfv_tab1;
DROP TABLE bfv_tab2_facttable1;
DROP TABLE bfv_tab2_dimdate;
DROP TABLE bfv_tab2_dimtabl1;
-- pick index scan when query has a relabel on the index key: non partitioned tables
set enable_seqscan = off;
-- start_ignore
drop table if exists Tab23383;
NOTICE:  table "tab23383" does not exist, skipping
-- end_ignore
create table Tab23383(a int, b varchar(20));
NOTICE:  Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Greenplum Database data distribution key for this table.
HINT:  The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
insert into Tab23383 select g,g from generate_series(1,1000) g;
create index Tab23383_b on Tab23383(b);
-- start_ignore
select disable_xform('CXformGet2TableScan');
          disable_xform          
---------------------------------
 CXformGet2TableScan is disabled
(1 row)

-- end_ignore
select count_index_scans('explain select * from Tab23383 where b=''1'';');
 count_index_scans 
-------------------
                 1
(1 row)

select * from Tab23383 where b='1';
 a | b 
---+---
 1 | 1
(1 row)

select count_index_scans('explain select * from Tab23383 where ''1''=b;');
 count_index_scans 
-------------------
                 1
(1 row)

select * from Tab23383 where '1'=b;
 a | b 
---+---
 1 | 1
(1 row)

select count_index_scans('explain select * from Tab23383 where ''2''> b order by a limit 10;');
 count_index_scans 
-------------------
                 1
(1 row)

select * from Tab23383 where '2'> b order by a limit 10;
 a  | b  
----+----
  1 | 1
 10 | 10
 11 | 11
 12 | 12
 13 | 13
 14 | 14
 15 | 15
 16 | 16
 17 | 17
 18 | 18
(10 rows)

select count_index_scans('explain select * from Tab23383 where b between ''1'' and ''2'' order by a limit 10;');
 count_index_scans 
-------------------
                 1
(1 row)

select * from Tab23383 where b between '1' and '2' order by a limit 10;
 a  | b  
----+----
  1 | 1
  2 | 2
 10 | 10
 11 | 11
 12 | 12
 13 | 13
 14 | 14
 15 | 15
 16 | 16
 17 | 17
(10 rows)

-- predicates on both index and non-index key
select count_index_scans('explain select * from Tab23383 where b=''1'' and a=''1'';');
 count_index_scans 
-------------------
                 1
(1 row)

select * from Tab23383 where b='1' and a='1';
 a | b 
---+---
 1 | 1
(1 row)

--negative tests: no index scan plan possible, fall back to planner
select count_index_scans('explain select * from Tab23383 where b::int=''1'';');
 count_index_scans 
-------------------
                 0
(1 row)

drop table Tab23383;
-- pick index scan when query has a relabel on the index key: partitioned tables
-- start_ignore
drop table if exists Tbl23383_partitioned;
NOTICE:  table "tbl23383_partitioned" does not exist, skipping
-- end_ignore
create table Tbl23383_partitioned(a int, b varchar(20), c varchar(20), d varchar(20))
partition by range(a)
(partition p1 start(1) end(500),
partition p2 start(500) end(1000) inclusive);
NOTICE:  Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Greenplum Database data distribution key for this table.
HINT:  The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
NOTICE:  CREATE TABLE will create partition "tbl23383_partitioned_1_prt_p1" for table "tbl23383_partitioned"
NOTICE:  CREATE TABLE will create partition "tbl23383_partitioned_1_prt_p2" for table "tbl23383_partitioned"
insert into Tbl23383_partitioned select g,g,g,g from generate_series(1,1000) g;
create index idx23383_b on Tbl23383_partitioned(b);
NOTICE:  building index for child partition "tbl23383_partitioned_1_prt_p1"
NOTICE:  building index for child partition "tbl23383_partitioned_1_prt_p2"
-- heterogenous indexes
create index idx23383_c on Tbl23383_partitioned_1_prt_p1(c);
create index idx23383_cd on Tbl23383_partitioned_1_prt_p2(c,d);
-- start_ignore
select disable_xform('CXformDynamicGet2DynamicTableScan');
                 disable_xform                 
-----------------------------------------------
 CXformDynamicGet2DynamicTableScan is disabled
(1 row)

-- end_ignore
select count_index_scans('explain select * from Tbl23383_partitioned where b=''1''');
 count_index_scans 
-------------------
                 2
(1 row)

select * from Tbl23383_partitioned where b='1';
 a | b | c | d 
---+---+---+---
 1 | 1 | 1 | 1
(1 row)

select count_index_scans('explain select * from Tbl23383_partitioned where ''1''=b');
 count_index_scans 
-------------------
                 2
(1 row)

select * from Tbl23383_partitioned where '1'=b;
 a | b | c | d 
---+---+---+---
 1 | 1 | 1 | 1
(1 row)

select count_index_scans('explain select * from Tbl23383_partitioned where ''2''> b order by a limit 10;');
 count_index_scans 
-------------------
                 2
(1 row)

select * from Tbl23383_partitioned where '2'> b order by a limit 10;
 a  | b  | c  | d  
----+----+----+----
  1 | 1  | 1  | 1
 10 | 10 | 10 | 10
 11 | 11 | 11 | 11
 12 | 12 | 12 | 12
 13 | 13 | 13 | 13
 14 | 14 | 14 | 14
 15 | 15 | 15 | 15
 16 | 16 | 16 | 16
 17 | 17 | 17 | 17
 18 | 18 | 18 | 18
(10 rows)

select count_index_scans('explain select * from Tbl23383_partitioned where b between ''1'' and ''2'' order by a limit 10;');
 count_index_scans 
-------------------
                 2
(1 row)

select * from Tbl23383_partitioned where b between '1' and '2' order by a limit 10;
 a  | b  | c  | d  
----+----+----+----
  1 | 1  | 1  | 1
  2 | 2  | 2  | 2
 10 | 10 | 10 | 10
 11 | 11 | 11 | 11
 12 | 12 | 12 | 12
 13 | 13 | 13 | 13
 14 | 14 | 14 | 14
 15 | 15 | 15 | 15
 16 | 16 | 16 | 16
 17 | 17 | 17 | 17
(10 rows)

-- predicates on both index and non-index key
select count_index_scans('explain select * from Tbl23383_partitioned where b=''1'' and a=''1'';');
 count_index_scans 
-------------------
                 1
(1 row)

select * from Tbl23383_partitioned where b='1' and a='1';
 a | b | c | d 
---+---+---+---
 1 | 1 | 1 | 1
(1 row)

--negative tests: no index scan plan possible, fall back to planner
select count_index_scans('explain select * from Tbl23383_partitioned where b::int=''1'';');
 count_index_scans 
-------------------
                 0
(1 row)

-- heterogenous indexes
select count_index_scans('explain select * from Tbl23383_partitioned where c=''1'';');
 count_index_scans 
-------------------
                 2
(1 row)

select * from Tbl23383_partitioned where c='1';
 a | b | c | d 
---+---+---+---
 1 | 1 | 1 | 1
(1 row)

-- start_ignore
drop table Tbl23383_partitioned;
-- end_ignore
reset enable_seqscan;
-- when optimizer is on PG exception raised during DXL->PlStmt translation for IndexScan query
-- start_ignore
drop table if exists tbl_ab;
NOTICE:  table "tbl_ab" does not exist, skipping
-- end_ignore
create table tbl_ab(a int, b int);
NOTICE:  Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Greenplum Database data distribution key for this table.
HINT:  The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
create index idx_ab_b on tbl_ab(b);
-- start_ignore
select disable_xform('CXformGet2TableScan');
          disable_xform          
---------------------------------
 CXformGet2TableScan is disabled
(1 row)

-- end_ignore
explain select * from tbl_ab where b::oid=1;
449 450 451 452
                                   QUERY PLAN                                   
--------------------------------------------------------------------------------
 Gather Motion 3:1  (slice1; segments: 3)  (cost=0.00..1176.25 rows=87 width=8)
   ->  Seq Scan on tbl_ab  (cost=0.00..1176.25 rows=29 width=8)
453 454 455 456 457 458
         Filter: b::oid = 1::oid
 Optimizer status: legacy query optimizer
(4 rows)

drop table tbl_ab;
drop function count_index_scans(text);