explain analyze faster then query

From: Mariel Cherkassky <mariel(dot)cherkassky(at)gmail(dot)com>
To: pgsql-performance(at)lists(dot)postgresql(dot)org, pgsql-admin(at)lists(dot)postgresql(dot)org
Subject: explain analyze faster then query
Date: 2018-11-25 13:08:33
Message-ID: CA+t6e1nb40u+EN3wUjFc6CzvkZ+0vjFr=dX+Y4QmA6tAwXLWEg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin 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.

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Justin Pryzby 2018-11-25 13:30:02 Re: explain analyze faster then query
Previous Message Achilleas Mantzios 2018-11-25 08:39:32 Re: could not connect to server, in order to operate pgAdmin/PostgreSQL

Browse pgsql-performance by date

  From Date Subject
Next Message Justin Pryzby 2018-11-25 13:30:02 Re: explain analyze faster then query
Previous Message Abi Noda 2018-11-24 03:53:14 Re: Performance impact of updating target columns with unchanged values ON CONFLICT