- Mastering PostgreSQL 10
- Hans Jürgen Sch?nig
- 124字
- 2021-06-30 19:03:56
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)
推薦閱讀
- 樂高機器人EV3設計指南:創造者的搭建邏輯
- R Machine Learning By Example
- 圖形圖像處理(Photoshop)
- 機器人智能運動規劃技術
- Apache Spark Deep Learning Cookbook
- Spark大數據技術與應用
- 自動控制理論(非自動化專業)
- PostgreSQL 10 Administration Cookbook
- 分數階系統分析與控制研究
- Hands-On Reactive Programming with Reactor
- 氣動系統裝調與PLC控制
- Extending Ansible
- 嵌入式操作系統原理及應用
- ESP8266 Robotics Projects
- 會聲會影X4中文版從入門到精通