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

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)
主站蜘蛛池模板: 南乐县| 张掖市| 留坝县| 宽甸| 泰安市| 黄山市| 中阳县| 绥阳县| 栾川县| 丹东市| 苗栗市| 丰顺县| 宁晋县| 邢台市| 崇文区| 铁力市| 明光市| 宝应县| 西充县| 鄂尔多斯市| 铜鼓县| 云阳县| 武城县| 韶关市| 仪陇县| 甘洛县| 饶阳县| 江达县| 丹东市| 墨玉县| 丰原市| 鄂尔多斯市| 炎陵县| 略阳县| 宜昌市| 周口市| 页游| 乌兰浩特市| 苏尼特左旗| 华亭县| 资源县|