* Ed Tyrrill (tyrrill_ed@xxxxxxx) wrote: > It seems to me that the first plan is the optimal one for this case, but > when the planner has more information about the table it chooses not to > use it. Do you think that if work_mem were higher it might choose the > first plan again? Seems likely to me. You understand that you can set the work_mem whenever you want, right? It's a GUC, so you could issue a 'set work_mem = blah' in the application code right before and right after (assuming you're going to continue using the session) this particular query, or just do it in a seperate session using 'explain' to play around with what the planner does given different arguments. 'explain's pretty cheap/easy, and you can play around with various settings to see what PG will do in various cases. Of course, you won't know the runtimes without doing 'explain analyze', but I think you have a good idea of the best plan for this query already... Thanks, Stephen
Attachment:
signature.asc
Description: Digital signature