Re: [PERFORM] performance problem with LIMIT (order BY in DESC order). Wrong index used?

2011-04-12 Thread Tom Lane
Claudio Freire writes: > Did you try increasing the statistic targets? > AFAIK, it looks a lot like the planner is missing stats, since it > estimates the index query on idx_nfi_newsfeed will fetch 10k rows - > instead of 25. BTW, this is the right suggestion, but for the wrong reason. You seem

Re: [PERFORM] performance problem with LIMIT (order BY in DESC order). Wrong index used?

2011-04-12 Thread Dieter Rehbein
thank's a lot guys, I will try that out. regards Dieter Am 12.04.2011 um 11:07 schrieb Claudio Freire: On Tue, Apr 12, 2011 at 10:59 AM, Dieter Rehbein wrote: > I just executed a VACUUM ANALYZE and now everything performs well. hm, > strange. That probably means you need more statistics -

Re: [PERFORM] performance problem with LIMIT (order BY in DESC order). Wrong index used?

2011-04-12 Thread tv
> On Tue, Apr 12, 2011 at 10:59 AM, Dieter Rehbein > wrote: >> I just executed a VACUUM ANALYZE and now everything performs well. hm, >> strange. > > That probably means you need more statistics - try increasing the > newsfeed's statistics target count. > > ALTER TABLE newsfeed_item ALTER COLUMN n

Re: [PERFORM] performance problem with LIMIT (order BY in DESC order). Wrong index used?

2011-04-12 Thread Claudio Freire
On Tue, Apr 12, 2011 at 10:59 AM, Dieter Rehbein wrote: > I just executed a VACUUM ANALYZE and now everything performs well. hm, > strange. That probably means you need more statistics - try increasing the newsfeed's statistics target count. ALTER TABLE newsfeed_item ALTER COLUMN newsfeed SET S

Re: [PERFORM] performance problem with LIMIT (order BY in DESC order). Wrong index used?

2011-04-12 Thread Dieter Rehbein
what I did, was an ANALYZE, which did not change anything. I just executed a VACUUM ANALYZE and now everything performs well. hm, strange. thanks Dieter Am 12.04.2011 um 09:42 schrieb Claudio Freire: On Tue, Apr 12, 2011 at 7:20 AM, Dieter Rehbein wrote: > Hi everybody, > > I have a perfor

Re: [PERFORM] performance problem with LIMIT (order BY in DESC order). Wrong index used?

2011-04-12 Thread Claudio Freire
On Tue, Apr 12, 2011 at 7:20 AM, Dieter Rehbein wrote: > Hi everybody, > > I have a performance-problem with a query using a LIMIT. There are other > threads rergading performance issues with LIMIT, but I didn't find useful > hints for our problem and it might > be interesting for other postgres

[PERFORM] performance problem with LIMIT (order BY in DESC order). Wrong index used?

2011-04-11 Thread Dieter Rehbein
Hi everybody, I have a performance-problem with a query using a LIMIT. There are other threads rergading performance issues with LIMIT, but I didn't find useful hints for our problem and it might be interesting for other postgres-users. There are only 2 simple tables: CREATE TABLE newsfeed (