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

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)
主站蜘蛛池模板: 芮城县| 民和| 元谋县| 康定县| 柯坪县| 通海县| 泸水县| 平昌县| 榕江县| 綦江县| 镇平县| 洮南市| 汽车| 八宿县| 安化县| 化隆| 韶关市| 辽阳县| 盐边县| 当涂县| 东兴市| 琼中| 罗定市| 佛教| 大余县| 赤水市| 石柱| 双城市| 大悟县| 黄陵县| 历史| 龙南县| 永德县| 启东市| 武威市| 湘潭县| 红河县| 岚皋县| 华宁县| 资源县| 龙川县|