Re: Query with order by and limit is very slow - wrong index used - Mailing list pgsql-performance

From Gregg Jaskiewicz
Subject Re: Query with order by and limit is very slow - wrong index used
Date
Msg-id CAJY59_jGxvDnr0RsU9+Sn8kdOYL2TqHLtNdtDCyP77dF=Ki4Gg@mail.gmail.com
Whole thread Raw
In response to Query with order by and limit is very slow - wrong index used  (Nowak Michał <michal.nowak@me.com>)
Responses Re: Query with order by and limit is very slow - wrong index used  (Nowak Michał <michal.nowak@me.com>)
List pgsql-performance
How many rows do you have in that table?

I think , that planner thinks that the element you are looking for is
so common - that it will be to expensive to use index to fetch it.
Perhaps try increasing default_statistics_target , and revacuuming the table.

You could also try changing it just for the column:

ALTER TABLE records ALTER id SET source_id 1000; vacuum analyze verbose records;

pgsql-performance by date:

Previous
From: Nowak Michał
Date:
Subject: Query with order by and limit is very slow - wrong index used
Next
From: Nowak Michał
Date:
Subject: Re: Query with order by and limit is very slow - wrong index used