"Craig A. James" <cjames@xxxxxxxxxxxxxxxx> writes: > It looks to me like the problem is the use of nested loops when a hash join should be used, but I'm no expert at query planning. Given the sizes of the tables involved, you'd likely have to boost up work_mem before the planner would consider a hash join. What nondefault configuration settings do you have, anyway? regards, tom lane