官术网_书友最值得收藏!

  • Mastering PostgreSQL 12
  • Hans Jürgen Sch?nig
  • 124字
  • 2021-08-20 10:00:29

Testing custom operator classes

In our example, the test data consists of just two rows. Therefore, PostgreSQL will never use an index because the table is just too small to justify the overhead of even opening the index. To be able to still test without having to load too much data, you can advise the optimizer to make sequential scans more expensive.

Making operations more expensive can be done in your session using the following instruction:

SET enable_seqscan TO off; 

The index works as expected:

test=# explain SELECT * FROM t_sva WHERE sva = '0000112273';  
                            QUERY PLAN 
------------------------------------------------------------------
Index Only Scan using idx_special on t_sva
(cost=0.13..8.14 rows=1 width=32)
Index Cond: (sva = '0000112273'::text)
(2 rows)

test=# SELECT * FROM t_sva;
sva
------------
2345010477
1118090878
(2 rows)
主站蜘蛛池模板: 西林县| 和林格尔县| 武宁县| 措美县| 永吉县| 承德县| 平泉县| 报价| 深州市| 濉溪县| 虞城县| 安龙县| 揭西县| 望奎县| 兴宁市| 和顺县| 榕江县| 郯城县| 昌邑市| 婺源县| 汪清县| 吉木萨尔县| 天镇县| 河池市| 政和县| 江源县| 南通市| 那坡县| 普定县| 房产| 香港 | 龙海市| 安丘市| 乌苏市| 安吉县| 剑阁县| 自贡市| 霍城县| 中西区| 房产| 益阳市|