PostgreSQL性能的一个奇怪的问题,查询,使用PostgreSQL的8.4.9。 此查询是在3D卷内select一组点,使用LEFT OUTER JOIN添加相关的ID列,其中存在相关的ID。 x范围的小改动可以使PostgreSQLselect一个不同的查询计划,这个计划的执行时间从0.01秒到50秒。 这是问题的查询: SELECT treenode.id AS id, treenode.parent_id AS parentid, (treenode.location).x AS x, (treenode.location).y AS y, (treenode.location).z AS z, treenode.confidence AS confidence, treenode.user_id AS user_id, treenode.radius AS radius, ((treenode.location).z – 50) AS z_diff, treenode_class_instance.class_instance_id AS skeleton_id FROM treenode LEFT OUTER JOIN (treenode_class_instance INNER JOIN class_instance ON treenode_class_instance.class_instance_id = class_instance.id AND class_instance.class_id = […]