goran wrote: > Trying to understand why query planer changes the plan from > effective one to ineffective one when I change the offset in the > LIMIT. Also, thankfully accepting RTFM pointers to the actual FMs. The query planner will consider offset and limit clauses when estimating the cost of each plan. The optimal plan will shift as more tuples need to be read. If the plan is not shifting at the right point, it probably means that you need to tune the costing factors used by the planner. You didn't report enough information for me to suggest any particular change; if you follow up, please review the suggested information to post: http://wiki.postgresql.org/wiki/SlowQueryQuestions In particular, information about the hardware and your postgresql.conf settings would help. You might also want to review this page and see if you can tune things. http://wiki.postgresql.org/wiki/Tuning_Your_PostgreSQL_Server In particular, effective_cache_size, random_page_cost, and seq_page_cost would be likely to need adjustment based on what you've told us; however, it might pay to review the whole configuration. -Kevin -- Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance