- Mastering PostgreSQL 9.6
- Hans Jurgen Schonig
- 124字
- 2021-07-09 19:57:20
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)
推薦閱讀
- Containers in OpenStack
- 在實戰中成長:C++開發之路
- PowerMill 2020五軸數控加工編程應用實例
- 21天學通Linux嵌入式開發
- 貫通開源Web圖形與報表技術全集
- 工業機器人集成應用
- Machine Learning with Spark(Second Edition)
- Learn Microsoft Azure
- Deep Learning Essentials
- FANUC工業機器人虛擬仿真教程
- 系統建模與控制導論
- Oracle Blockchain Quick Start Guide
- 7天精通Photoshop CS5平面視覺設計
- Arduino創意機器人入門:基于Mind+
- Data Science with Python