Re: Query only slow on first run

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----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. 


---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
       choose an index scan if your joining column's datatypes do not
       match

[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux