Re: Query only slow on first run - Mailing list pgsql-performance

From Dave Dutcher
Subject Re: Query only slow on first run
Date
Msg-id 05e801c831d7$bea1bee0$8e00a8c0@tridecap.com
Whole thread Raw
In response to Re: Query only slow on first run  (tmp <skrald@amossen.dk>)
Responses Re: Query only slow on first run
List pgsql-performance
> -----Original Message-----
> From: tmp
> We have primarily two tables of interest here: questions
> (~100k rows) and posts (~400k rows). Each post refers to a
> question, but only the "posts" rows for which the
> corresponding "question.status = 1" are relevant. This
> reduces the number of relevant question rows to about 10k.

Earlier you said only a small subset of questions have a status of 1, so I
assumed you meant like 100 not 10k :)  According to the explain analyze
there are only 646 rows in posts which match your criteria, so it does seem
like scanning posts first might be the right thing to do.


pgsql-performance by date:

Previous
From: Tom Lane
Date:
Subject: Re: GiST indexing tuples
Next
From: Matthew
Date:
Subject: Re: GiST indexing tuples