explain analyze faster then query

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

 



Hi,
I'm using postgres 9.6.
I have a table with 100M+ records which consume on disk about 8GB. In addition I have an index on the id column of the table.
When I run in psql : explain analyze select id from my_table order by id 
The query returns output after 130 seconds which is great. The plan that is chosen is Index only scan.
However when I run the query without the explain analyze it takes forever to run it(More then two hours). 
All the statistics are accurate and work_mem set to 4MB. What there is so much difference between running the query with explain analyze and without ?
Is there a possibility that it is related to fetching or something like that ?

Thanks.

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

  Powered by Linux