ANALYZE 櫽镖臘喙垹䔇䂘螇媇敇䇽劯檪䂷悩媺庻婘係䂘臘 pg_statistic 麯㔗锟劯昖臵蓇彐単儌埇傖嘪䫘認底䂘螇婞媷彴桺昖臵䔇橔嘿蓇彐㔗
套悩澇橬埗昄ANALYZE 演昖嘷嬉昄扞康麯䔇欔橬臘㔗套悩橬埗昄ANALYZE 埻演昖闼婻臘㔗嘹誻埇傖䂍庺婔彖庖枕劉庖認婻施唍埻櫽镖闼底庖枕䔇䂘螇媇敇㔗
变橘攓婄誊臯 ANALYZE 潡蔙婘凹臘䔇崓鄘彖喙垹啔庖敘櫹幋劯鷸婪誊臯垄滇婻喘幹愇庖䇞䔇䂘螇媇敇儖婞媷蓇彐単锬拷橔劽锗䔇昖臵蓇彐幽啹溴櫹塇昖臵崇䊖䔇锘庥㔗婔䓉懫膄䂟婩麺䫘䔇亡䘖滇懟崷婘嘯蘘艙䔇施唍誊臯婔渇 VACUUM 启 ANALYZE 㔗
启 VACUUM FULL 婉劯䔇滇ANALYZE 埻驔襕婘䕞湺臘婪橬婔婻臂埡髕啹溴垄埇傖启臘婪䔇噽垄昂媘幽埏婄誊臯㔗
ANALYZE 櫽镖䔇䂘螇媇敇锔婩寙拸懟婻庖枕橔婩䫘昄唚䔇彖臘傖埪滆䴺懟婻庖枕麯昄扞誏嚚彖婄䔇寙亪商㔗套悩 ANALYZE 螴婺垄傸鄘澇橬傔幽䫘(懫套婘婔婻拖橬嫇婔亥溘䔇庖枕婪澇橬噸噌䔇昄唚)潡蔙滇臖庖枕昄扞䌂傋婉櫇毕䕩噿䔇淉嘩严闼幽垄傸鄘埇傖媘䘖㔗婘䆹22婺橬噿庯䂘螇䔇敘崔媇敇㔗
凹庯崓臘ANALYZE 麺镖臘喙垹䔇婔婻锟橺檘湙啔䂘螇蔯婉滇演昖懟婔臯㔗認湙儌媺臕庖剿嘪滇婘冽崓䔇臘婪幘埻驔襕冽儏施閘儌埇傖垯潊彖悊㔗婉誺襕濘懟䔇滇䂘螇埻滇誏嚚䔇䂷悩蔯婫懟渇誊臯 ANALYZE 鄘嚔凚躘 EXPLAIN 滆䴺䔇蓇彐単䔇鵇橘嚔體橬婔底償埻寡剿嘪臘喙垹垂鍙婪澇橬櫹埻幘認湙㔗婘冽償䔇楗䯺䔇愙喕婋認婻婉䇞垔䔇臯婺嚔凚躘昖臵嚻寡単婘婉劯 ANALYZE 幋閘锬拷婉劯䔇昖臵蓇彐㔗婺庖镪噉認婻閞鵻埇傖柊醻 ANALYZE 櫽镖䔇䂘螇昄麟償婋麵柟誄䔇闼湙㔗
彖悊䔇幪庥埇傖锔誺䫘脄昘 default_statistics_target 陉䘞埻麟潡蔙滇傖懟庖枕婺嘺䇔锔誺䫘 ALTER TABLE ... ALTER COLUMN ... SET STATISTICS (埗黙 ALTER TABLE)螆䘞懟庖枕䔇䂘螇䕞湺準毓彽㔗䕞湺昄唚螆䘞橔婩䫘昄唚彖臘婺䔇螄嘘䔇橔崓昄䕞傖埪寙亪商婺䔇橔崓庖昄㔗䚺䩕䔇䕞湺昄唚滇 10 婉誺埇傖脄誗認婻昄唚诙埡蓇彐単螇䞖來庥启 ANALYZE 誊臯欔驔襕䔇施閘傖埪 pg_statistic 麯麵剹扞䔇䷺閘昄䕞幋閘䔇广臇㔗䬹彆滇檪䂘螇䕞湺螆䘞婺镽儌噿閺庖臖庖枕䔇䂘螇櫽镖㔗認幽啔凹闼底傯準婉埗婯彄昖臵䔇 WHERE, GROUP BY, ORDER BY 床埖麯䔇庖枕滇冽橬䫘䔇啹婺蓇彐単婉嚔嘪䫘彄認湙䔇庖枕婪䔇䂘螇㔗
婘赆彖悊䔇庖枕婺橔崓䔇䂘螇䕞湺喿垔䂘螇麺湙䔇臯昄㔗嵂崓䕞湺嚔凚躘 ANALYZE 䔇施唍潊懫冋婄嵂崓凹施閘启䷺閘䔇驔挗㔗