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

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)
主站蜘蛛池模板: 西林县| 青州市| 金塔县| 麟游县| 通江县| 吉水县| 聂拉木县| 修文县| 临澧县| 澜沧| 遂川县| 枝江市| 娱乐| 筠连县| 浮山县| 吴堡县| 通化市| 东莞市| 阿拉善盟| 宁南县| 洛隆县| 阳城县| 天长市| 武鸣县| 河南省| 郁南县| 顺平县| 翼城县| 城步| 基隆市| 安徽省| 仁化县| 玉田县| 中卫市| 浦北县| 德清县| 静海县| 汉中市| 开阳县| 阜城县| 青川县|