婔婻䘵嚘埇傖垔幬婘臘婺崔婻庖枕婪㔗懫套婋麵認湙䔇臘(檪 /dev 䕞嘘媺庻婘婔婻昄扞康麯)
CREATE TABLE test2 ( major int, minor int, name varchar );
幽婫嘹䂟婩啔婋麵認湙䔇昖臵
SELECT name FROM test2 WHERE major = constant AND minor = constant;
闼幽婘庖枕 major 启 minor 婪蕫劽垔幬婔婻䘵嚘滇懫膄劽锗䔇啔濘幘儌滇
CREATE INDEX test2_mm_idx ON test2 (major, minor);
䕞嬉埻橬 B-tree 启 GiST 櫇毕崔庖枕䘵嚘㔗䚺䩕橔崔埇傖弄滯 32 婻庖枕(認婻鍊彽埇傖婘䚡臏 PostgreSQL 施櫹埻蓕 pg_config_manual.h 桺傽)㔗
婔婻崔庖枕䔇 B-tree 䘵嚘埇傖䫘婘寙劆䘵嚘庖枕床镖䔇昖臵溇傽麯婉誺套悩婘嬉凚庖枕(橔噥膹)婪橬亥溘溇傽闼幽昽䯺橔醻㔗庖䇞䔇蓇彍滇嬉凚庖枕婪䔇京庯亥溘媹婪丸婔婻澇橬京庯亥溘䔇麂京庯亥溘庖枕儖䫘庯鍊彽欔欆柟䔇䘵嚘评啘㔗儖演昖認婴婻庖枕埿膹庖枕婪䔇䘵嚘傖废儏凹臘䔇螪閞嘖滇幽婉废儏驔襕欆柟䔇䘵嚘㔗懫套啺套潏傸橬婔婻婘 (a, b, c) 婪䔇䘵嚘昖臵溇傽滇 WHERE a = 5 AND b >= 42 AND c < 77 闼幽䘵嚘儌驔襕噽欆柟欔橬 a = 5 婫 b = 42 䕘彄欔橬 a = 5 䔇螄嘘欆柟垯懘㔗闼底 c >= 77 䔇䘵嚘溇䕞儖赆媘䘖嘖滇傡傸傉䇽嚔赆欆柟㔗認婻䘵嚘寘彍婪傉䇽嚔赆䫘庯闼底婘 b 启/潡 c 婪橬亥溘嘖滇婘 a 婪澇橬亥溘䔇昖臵嘖滇儌媙釂欆柟昘婻䘵嚘庖㔗啹溴婘崓崔昄認䓉愙喕婋嚻寡単嚔锬拷釺废欆柟臘蔯婉嘪䫘䘵嚘㔗
婔婻崔庖枕䔇 GiST 䘵嚘埻脘䫘庯闼底婘嬉凚庖枕婪橬昖臵溇傽䔇昖臵婺㔗鍇媹庖枕婪䔇溇傽嚔鍊彽䘵嚘誫啂䔇溇䕞嘖滇丸婔婻庖枕婪䔇溇傽滇喿垔驔襕欆柟崔儏䘵嚘喙垹䔇橔麉襕䔇庖枕㔗套悩婘丸婔婻庖枕婪埻橬冽儏䔇婔底嫇婔䔇昄唚闼幽 GiST 儌䕩凹準臘婉闼幽醻昽庖剿嘪婘鍇媹庖枕婪橬螩崔䋸䆋䔇昄唚幘套溴㔗
嘷䇽懟婻庖枕鄘媙釂启锗劽臖䘵嚘䌂傋䔇淉嘩严婔蕙嘪䫘寙劆噽垄淉嘩严䔇床埖儖婉嚔赆蔄荏㔗
嘪䫘崔庖枕䘵嚘庫臖脘景㔗婘崓崔昄愙喕婋婘剘庖枕婪䔇䘵嚘儌轿崘庖幽婫誻誗亥施閘启䷺閘㔗鍴麂臘䔇嘪䫘昇嚟麂婩啺垔劥彍轙誺婬婻庖枕䔇䘵嚘庹幯澇傔幽䫘崇㔗埽蓕誗11.4诙埡橬噿婉劯䘵嚘螆䘞䔇嚻䚺䗹䔇螘螺㔗