explain analyze faster then query - Mailing list pgsql-performance

From Mariel Cherkassky
Subject explain analyze faster then query
Date
Msg-id CA+t6e1nb40u+EN3wUjFc6CzvkZ+0vjFr=dX+Y4QmA6tAwXLWEg@mail.gmail.com
Whole thread Raw
Responses Re: explain analyze faster then query
List pgsql-performance
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.

pgsql-performance by date:

Previous
From: Abi Noda
Date:
Subject: Re: Performance impact of updating target columns with unchangedvalues ON CONFLICT
Next
From: Justin Pryzby
Date:
Subject: Re: explain analyze faster then query