- Mastering PostgreSQL 9.6
- Hans Jurgen Schonig
- 172字
- 2021-07-09 19:57:18
Combined indexes
In my job as a professional PostgreSQL support vendor, I am often asked about the difference between a combined and individual indexes. In this section, I will try to shed some light on this question.
The general rule is this: if a single index can answer your question, it is usually the best choice. However, you cannot index all possible combinations of fields people are filtering on. What you can do is use the properties of combined indexes to achieve as much gain as possible.
Let us suppose we have a table containing three columns: postal_code, last_name, and first_name. A telephone book would make use of a combined index like that. You will see that data is ordered by location. Within the same location, data will be sorted by last name and first name.
The following table will show which operations are possible given the three column index:

If columns are indexes separately, you will most likely end up seeing bitmap scans. Of course, a single hand-tailored index is better.
- AutoCAD繪圖實用速查通典
- 西門子PLC與InTouch綜合應(yīng)用
- 人工智能工程化:應(yīng)用落地與中臺構(gòu)建
- JBoss ESB Beginner’s Guide
- Word 2007,Excel 2007辦公應(yīng)用融會貫通
- 在實戰(zhàn)中成長:Windows Forms開發(fā)之路
- 青少年VEX IQ機(jī)器人實訓(xùn)課程(初級)
- Mastering Ansible(Second Edition)
- 基于RPA技術(shù)財務(wù)機(jī)器人的應(yīng)用與研究
- 寒江獨釣:Windows內(nèi)核安全編程
- Cloudera Hadoop大數(shù)據(jù)平臺實戰(zhàn)指南
- QTP自動化測試實踐
- 智能控制技術(shù)及其應(yīng)用
- 巧學(xué)活用AutoCAD
- PVCBOT零基礎(chǔ)機(jī)器人制作(第2版)