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

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)
主站蜘蛛池模板: 台中市| 安多县| 白山市| 长白| 嘉兴市| 霍林郭勒市| 台山市| 苏州市| 淮滨县| 株洲县| 怀集县| 宾阳县| 卢湾区| 巴林左旗| 满洲里市| 区。| 治多县| 丹寨县| 建始县| 余江县| 双辽市| 乳山市| 黄山市| 根河市| 石泉县| 濮阳县| 霍林郭勒市| 宁河县| 保山市| 吉林省| 加查县| 满洲里市| 鄂州市| 澳门| 宜黄县| 平南县| 乌拉特前旗| 鹤山市| 云林县| 宁都县| 西华县|