- Mastering PostgreSQL 12
- Hans Jürgen Sch?nig
- 124字
- 2021-08-20 10:00:29
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)
推薦閱讀
- 三菱FX3U/5U PLC從入門到精通
- PostgreSQL 11 Server Side Programming Quick Start Guide
- 7天精通Dreamweaver CS5網頁設計與制作
- Java開發技術全程指南
- 圖解PLC控制系統梯形圖和語句表
- Mastering Salesforce CRM Administration
- 嵌入式Linux上的C語言編程實踐
- 數據庫原理與應用技術
- Windows內核原理與實現
- 變頻器、軟啟動器及PLC實用技術260問
- 網絡安全與防護
- Docker on Amazon Web Services
- MCGS嵌入版組態軟件應用教程
- PLC與變頻技術應用
- Mastering Geospatial Analysis with Python