PostgreSQL 12.8 Same Query Same Execution Plan Different Time

2022-01-19 Thread Ludwig Isaac Lim
Hello: I ran 2 same queries on PostgreSQL 12.8 machine running in AWS RDS, the first time I ran the query the query plan was: GroupAggregate  (cost=455652.07..455664.99 rows=340 width=16) (actual time=124047.119..124048.777 rows=294 loops=1)    Group Key: dvh.history_date    ->  Sort  (cost=45

Re: PostgreSQL 12.8 Same Query Same Execution Plan Different Time

2022-01-19 Thread David G. Johnston
On Wed, Jan 19, 2022 at 7:59 AM Ludwig Isaac Lim wrote: > > I noticed that different is actually in Nested Loop join. One is taking 2 > minutes, other is taking 12 seconds. I find this puzzling as I assume the > nested loop should be done in memory. > Everything is done in memory, but the data h