Re: Query taking too long. Problem reading explain output.

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

 



Henrik wrote:

> Correct. I changed the statistics to 500 in tbl_file.file_name  and now the 
> statistics is better. But now my big seq scan on tbl_file_Structure back 
> and I don't know why.

Hmm, I think the problem here is that it needs to fetch ~200000 tuples
from tbl_file_structure one way or the other.  When it misestimated the
tuples from tbl_file it thought it would only need to do the indexscan
in tbl_file_structure a few times, but now it realizes that it needs to
do it several thousands of times and it considers the seqscan to be
cheaper.

Perhaps you would benefit from a higher effective_cache_size or a lower
random_page_cost (or both).

I think this is a problem in the optimizer: it doesn't correctly take
into account the fact that the upper pages of the index are most likely
to be cached.  This has been discussed a lot of times but it's not a
simple problem to fix.

-- 
Alvaro Herrera                 http://www.amazon.com/gp/registry/CTMLCN8V17R4
Este mail se entrega garantizadamente 100% libre de sarcasmo.

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

               http://archives.postgresql.org

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

  Powered by Linux