- 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)
推薦閱讀
- 輕松學(xué)C語(yǔ)言
- Go Machine Learning Projects
- 工業(yè)機(jī)器人產(chǎn)品應(yīng)用實(shí)戰(zhàn)
- Security Automation with Ansible 2
- INSTANT Varnish Cache How-to
- Photoshop CS3圖像處理融會(huì)貫通
- 構(gòu)建高性能Web站點(diǎn)
- CompTIA Linux+ Certification Guide
- Apache Superset Quick Start Guide
- Linux嵌入式系統(tǒng)開發(fā)
- 簡(jiǎn)明學(xué)中文版Photoshop
- 無人駕駛感知智能
- Hands-On Deep Learning with Go
- 基于Proteus的PIC單片機(jī)C語(yǔ)言程序設(shè)計(jì)與仿真
- PHP求職寶典