1
PostgreSQL 9.6中不需要的Nest Loop与Hash Join
我在PostgreSQL 9.6查询计划上遇到麻烦。我的查询如下所示: SET role plain_user; SELECT properties.* FROM properties JOIN entries_properties ON properties.id = entries_properties.property_id JOIN structures ON structures.id = entries_properties.entry_id WHERE structures."STRUKTURBERICHT" != '' AND properties."COMPOSITION" LIKE 'Mo%' AND ( properties."NAME" LIKE '%VASP-ase-preopt%' OR properties."CALCULATOR_ID" IN (7,22,25) ) AND properties."TYPE_ID" IN (6) 我为上述表启用了行级安全性。 使用set enable_nestloop = True,查询计划器将运行嵌套循环,其总运行时间约为37秒:https : //explain.depesz.com/s/59BR …