<div><div>Hello Liam,</div><div> </div><div>- Have you checked logs to see what happened in the morning?</div><div>- Is the log_lock_waits parameter enabled?</div><div>- What postgres version do you use?</div><div>- Is 43 min 11 seconds total duration or max duration?</div></div><div> </div><div>Best regards.</div><div>Samed YILDIRIM</div><div> </div><div> </div><div> </div><div>03.12.2021, 14:24, "liam saffioti" <liam(dot)saffiotti(at)gmail(dot)com>:</div><blockquote><div><div>Hello Team,<div> </div><div>I have a problem with a query that consumes a long time. </div><div>The query' execution plan is :</div><div> </div><div> </div><div>EXPLAIN ANALYZE SELECT x."HistoryId", x."SlaDefinition" FROM "T_CMN_SLAHISTORY" AS x WHERE x."DefinitionId" = '302';<br /> QUERY PLAN <br />-----------------------------------------------------------------------------------------------------------------------------------------------------------<br /> Bitmap Heap Scan on "T_CMN_SLAHISTORY" x (cost=2144.77..35086.42 rows=139012 width=8) (actual time=58.806..116.874 rows=135498 loops=1)<br /> Recheck Cond: ("DefinitionId" = 302)<br /> Heap Blocks: exact=2175<br /> -> Bitmap Index Scan on "Index-20180712-192739" (cost=0.00..2110.02 rows=139012 width=0) (actual time=57.043..57.045 rows=135498 loops=1)<br /> Index Cond: ("DefinitionId" = 302)<br /> Planning Time: 11.132 ms<br /> Execution Time: 120.320 ms</div><div> </div><div> </div><div> </div><div>But, the query execution time was 43min 11seconds in the morning in pgbadger report. I don't understand why the query is taking so long. Can you guide me?</div><div> </div><div>Thank you so much.</div><div> </div></div></div></blockquote>