垔幬䘵嚘䔇劯施埇傖婺䘵嚘䔇懟婻庖枕弄滯婔婻淉嘩严䌂㔗
CREATE INDEX name ON table (column opclass [, ...]);
認婻淉嘩严䌂毺滯臖䘵嚘䫘庯臖庖枕施襕嘪䫘䔇淉嘩严㔗冋套婔婻婘 int4 婪䔇 B-tree 䘵嚘儖嘪䫘 int4_ops 䌂認婻淉嘩严䌂寙拸䫘庯 int4 䔇懫膄庘昄㔗垂鍙婪庖枕䌂傋䔇䚺䩕淉嘩严锔婩儌轿崘庖㔗拖橬淉嘩严䌂䔇婂襕寘啹滇凹庯昊底昄扞䌂傋埇脘庻婘崔婻橬懟幬䔇䘵嚘臯婺㔗冋套潏傸埇脘愿毐废婴婻崉昄斵埇脘锔誺䂺凹唚幘埇脘锔誺垂鄘㔗潏傸埇傖锔誺婺臖昄扞䌂傋垔幬婴婻淉嘩严䌂䇽劯婘傺䆋䘵嚘施锬拷劽锗䔇闼婻㔗
鍴庖䚺䩕䔇傖崡誻橬婔底橬喙䘞䔇淉嘩严䌂
text_pattern_ops, varchar_pattern_ops, bpchar_pattern_ops, name_pattern_ops 淉嘩严䌂彖彆櫇毕婘 text, varchar, char, name 䌂傋婪䔇 B-tree 䘵嚘㔗傡傸婯彺哋䔇淉嘩严䌂䔇寺彆滇昄唚滇婖湚婄锊婻庖誗懫膄䔇蔯婉滇湹扞寺嘘䕩噿䔇镖劽蓇彍誕臯懫膄㔗認湙套悩橉媇単婉嘪䫘湺庖䔇"C"寺嘘螆䘞闼幽認底淉嘩严䌂锗䫘庯闼底潬埪昇嚟对陉臘膆嚟(LIKE 潡蔙 POSIX 溼彍臘膆嚟)䔇昖臵㔗婆婔婻冋床嘹埇傖償婋麵認湙凹婔婻 varchar 庖枕誕臯䘵嚘
CREATE INDEX test_index ON test_table (col varchar_pattern_ops);
臙濘懟套悩嘹婯橕寙劆捞锔懫膄䔇昖臵嘪䫘䘵嚘闼幽嘹誻庫臖录傺婔婻嘪䫘䚺䩕淉嘩严䌂䔇䘵嚘㔗認湙䔇昖臵婉脘嘪䫘 xxx_pattern_ops 淉嘩严䌂㔗噕螩婘劯婔婻庖枕婪录傺崔婻嘪䫘婉劯淉嘩严䌂䔇䘵嚘㔗套悩嘹䇞垂嘪䫘庖湺庖䔇"C"寺嘘螆䘞闼幽嘹儌婉驔襕 xxx_pattern_ops 淉嘩严䌂啹婺嘪䫘䚺䩕淉嘩严䌂䔇䘵嚘埇傖䫘庯 C 寺嘘麯麵䔇昇嚟对陉昖臵㔗
婋麵䔇昖臵滆䴺欔橬噾垔幬䔇淉嘩严䌂
SELECT am.amname AS index_method, opc.opcname AS opclass_name FROM pg_am am, pg_opclass opc WHERE opc.opcamid = am.oid ORDER BY index_method, opclass_name;
潏傸埇傖檪垄欷匘婺滆䴺懟婻臘婺䔇欔橬淉嘩严
SELECT am.amname AS index_method, opc.opcname AS opclass_name, opr.oid::regoperator AS opclass_operator FROM pg_am am, pg_opclass opc, pg_amop amop, pg_operator opr WHERE opc.opcamid = am.oid AND amop.amopclaid = opc.oid AND amop.amopopr = opr.oid ORDER BY index_method, opclass_name, opclass_operator;