postgresql long running query

From: liam saffioti <liam(dot)saffiotti(at)gmail(dot)com>
To: pgsql-admin <pgsql-admin(at)lists(dot)postgresql(dot)org>, Julien Rouhaud <rjuju123(at)gmail(dot)com>
Subject: postgresql long running query
Date: 2021-12-03 11:24:15
Message-ID: CAGHjuaZkGZVRK6OC4ifBJVQ+=1Y=0CXdDnZ7sjHkdfY2wkACVg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hello Team,

I have a problem with a query that consumes a long time.
The query' execution plan is :

EXPLAIN ANALYZE SELECT x."HistoryId", x."SlaDefinition" FROM
"T_CMN_SLAHISTORY" AS x WHERE x."DefinitionId" = '302';

QUERY PLAN

-----------------------------------------------------------------------------------------------------------------------------------------------------------
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)
Recheck Cond: ("DefinitionId" = 302)
Heap Blocks: exact=2175
-> 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)
Index Cond: ("DefinitionId" = 302)
Planning Time: 11.132 ms
Execution Time: 120.320 ms

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?

Thank you so much.

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Samed YILDIRIM 2021-12-03 11:32:31 Re: postgresql long running query
Previous Message Jiankang Ji 2021-12-02 09:16:31 Re: Are you working on both pentaho and postgresql?