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

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 inside 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)
主站蜘蛛池模板: 大洼县| 万载县| 五台县| 揭西县| 江陵县| 龙门县| 乡宁县| 婺源县| 日喀则市| 鸡东县| 临颍县| 大洼县| 栾川县| 监利县| 荣昌县| 木兰县| 个旧市| 长阳| 明星| 靖宇县| 安顺市| 东兰县| 中江县| 凤翔县| 邵东县| 介休市| 平果县| 连平县| 东明县| 宿迁市| 民丰县| 胶南市| 珲春市| 白河县| 油尖旺区| 怀仁县| 政和县| 沈阳市| 彩票| 台湾省| 兰州市|