On Wed, Jul 6, 2011 at 5:50 AM, Matthias Howell <Matthias.Howell@xxxxxxxxx> wrote:
However, in the end, it was user brain damage.
It does use the doc id index for the subquery, but for some reason, the primary key on sentences - the sentenceid - was not set. So in fact, there is no index.
Machines vindicated once again.
For the record, if you follow the instructions for submitting slow query questions, we'd likely have spotted it very quickly if you hadn't spotted it yourself while doing the cut and paste. The instructions ask for table definitions, so you'd likely have noticed the missing index when you copied those into your email. The link (http://wiki.postgresql.org/wiki/SlowQueryQuestions ) is right there on the mailing list page at postgresql.org. It's always a toss-up whether to attempt to answer a question like yours or just respond with a link to that page when the relevant info is missing ;-)
--sam