Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-24919

Slow query in alerts syncer

XMLWordPrintable

    • Icon: Problem report Problem report
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • None
    • Server (S)
    • Support backlog

      slow query: 142.747892 sec

      133841:20240726:141207.897 slow query: 142.747892 sec, "select a.alertid,a.mediatypeid,a.sendto,a.subject,a.message,a.status,a.retries,e.source,e.object,e.objectid,a.parameters,a.eventid,a.p_eventid from alerts a left join events e on a.eventid=e.eventid where alerttype=0 and a.status in (3,0) order by a.alertid"
      
      zabbix=> explain analyze select a.alertid,a.mediatypeid,a.sendto,a.subject,a.message,a.status,a.retries,e.source,e.object,e.objectid,a.parameters,a.eventid,a.p_eventid from alerts a left join events e on a.eventid=e.eventid where alerttype=0 and a.status in (3,0) order by a.alertid;
                                                                        QUERY PLAN
      -----------------------------------------------------------------------------------------------------------------------------------------------
       Gather Merge  (cost=119381.47..132737.24 rows=114470 width=1277) (actual time=333.545..561.609 rows=153255 loops=1)
         Workers Planned: 2
         Workers Launched: 2
         ->  Sort  (cost=118381.45..118524.53 rows=57235 width=1277) (actual time=306.155..323.974 rows=51085 loops=3)
               Sort Key: a.alertid
               Sort Method: external merge  Disk: 76920kB
               Worker 0:  Sort Method: external merge  Disk: 74296kB
               Worker 1:  Sort Method: external merge  Disk: 74112kB
               ->  Hash Left Join  (cost=1595.96..50081.56 rows=57235 width=1277) (actual time=34.712..180.051 rows=51085 loops=3)
                     Hash Cond: (a.eventid = e.eventid)
                     ->  Parallel Seq Scan on alerts a  (cost=0.00..48335.34 rows=57235 width=1261) (actual time=18.638..151.446 rows=51085 loops=3)
                           Filter: ((status = ANY ('{3,0}'::integer[])) AND (alerttype = 0))
                           Rows Removed by Filter: 24699
                     ->  Hash  (cost=986.54..986.54 rows=48754 width=24) (actual time=15.837..15.840 rows=48747 loops=3)
                           Buckets: 65536  Batches: 1  Memory Usage: 3178kB
                           ->  Seq Scan on events e  (cost=0.00..986.54 rows=48754 width=24) (actual time=0.049..8.780 rows=48747 loops=3)
       Planning Time: 7.849 ms
       JIT:
         Functions: 39
         Options: Inlining false, Optimization false, Expressions true, Deforming true
         Timing: Generation 1.933 ms, Inlining 0.000 ms, Optimization 3.060 ms, Emission 46.272 ms, Total 51.265 ms
       Execution Time: 680.736 ms
      (22 rows)
      

            arimdjonoks Artjoms Rimdjonoks
            arimdjonoks Artjoms Rimdjonoks
            Team C
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: