Debug WebUI: SQL (81.735033): SELECT COUNT(*) AS rowscount,a.eventid FROM alerts a WHERE EXISTS (SELECT NULL FROM actions aa WHERE a.actionid=aa.actionid AND aa.eventsource='0') AND a.eventid IN (1917584,1917589,1917612,1918247,1918707,1918711,1919871,1919876,1919885,2646854,3512704,3515337,3529042,3529051,3529745,3529764,3529873,3529875,3560887,3589542,3601809,3601815,3601819,3601820,3601821,3601824,3601841,3601850,3610947,3614349,3646525,3646533,3646554,3646733,3646737,3653434,3653438,3653594,3653599,3653605,3653826,3653834,3653835,3653849,3653854,3653857,3653858,3653862,3653870,3653871,3653872,3653879,3653883,3653900,3653926,3653936,3653949,3653965,3653979,3654166,3654169,3654177,3654179,3654181,3654185,3654188,3654194,3654199,3654202,3654205,3654209,3654211,3654219,3695041,3695052,3695054,3695062,3695073,3695087,3695099,3695253,3695320,3695567,3695568,3695569,3695570,3695572,3698324,3698331,3712695,3718317,3718323,3753468,3753529,3753748,3755376,3763184,3763200,3763201,3763213,3763223,3763233,3763557,3763560,3763561,3763565,3763569,3763575,3763576,3763581,3763582,3763592,3763593,3763603,3763628,3763864,3763900,3763906,3819506,3820613,3862875,3862958,3863527,3863528,3864267,4018743,4018997,4108455,4115714,4504058,4555618,4589979,4591324,4591554,4591651,4592106,4708825,4708945,4711388,4720657,4751732,4751745,4752648,4778674,4821761,4880979,4880988,4880990,4882066,4882067,4882068,4887041,4887043,4887067,4887068,4936352,4954130,5020710,5021499,5021668,5022132,5081539,5155512,5233902,5293166,5293991,5294069,5294995,5298746,5302504,5305133,5333688,5382465,5406479,5457728,5461430,5466239,5473127,5480011,5481550,5499977,5501464,5502227,5505308,5506071,5506168,5508009,5513491,5513649,5518069,5518425,5519075,5521626,5522590,5522802,5523501,5523626,5523699,5524008,5524046) GROUP BY a.eventid ---- zabbix=# EXPLAIN ANALYSE SELECT COUNT(*) AS rowscount,a.eventid FROM alerts a WHERE EXISTS (SELECT NULL FROM actions aa WHERE a.actionid=aa.actionid AND aa.eventsource='0') AND a.eventid IN (1917584,1917589,1917612,1918247,1918707,1918711,1919871,1919876,1919885,2646854,3512704,3515337,3529042,3529051,3529745,3529764,3529873,3529875,3560887,3589542,3601809,3601815,3601819,3601820,3601821,3601824,3601841,3601850,3610947,3614349,3646525,3646533,3646554,3646733,3646737,3653434,3653438,3653594,3653599,3653605,3653826,3653834,3653835,3653849,3653854,3653857,3653858,3653862,3653870,3653871,3653872,3653879,3653883,3653900,3653926,3653936,3653949,3653965,3653979,3654166,3654169,3654177,3654179,3654181,3654185,3654188,3654194,3654199,3654202,3654205,3654209,3654211,3654219,3695041,3695052,3695054,3695062,3695073,3695087,3695099,3695253,3695320,3695567,3695568,3695569,3695570,3695572,3698324,3698331,3712695,3718317,3718323,3753468,3753529,3753748,3755376,3763184,3763200,3763201,3763213,3763223,3763233,3763557,3763560,3763561,3763565,3763569,3763575,3763576,3763581,3763582,3763592,3763593,3763603,3763628,3763864,3763900,3763906,3819506,3820613,3862875,3862958,3863527,3863528,3864267,4018743,4018997,4108455,4115714,4504058,4555618,4589979,4591324,4591554,4591651,4592106,4708825,4708945,4711388,4720657,4751732,4751745,4752648,4778674,4821761,4880979,4880988,4880990,4882066,4882067,4882068,4887041,4887043,4887067,4887068,4936352,4954130,5020710,5021499,5021668,5022132,5081539,5155512,5233902,5293166,5293991,5294069,5294995,5298746,5302504,5305133,5333688,5382465,5406479,5457728,5461430,5466239,5473127,5480011,5481550,5499977,5501464,5502227,5505308,5506071,5506168,5508009,5513491,5513649,5518069,5518425,5519075,5521626,5522590,5522802,5523501,5523626,5523699,5524008,5524046) GROUP BY a.eventid; QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- HashAggregate (cost=367601.92..367646.91 rows=4499 width=16) (actual time=13722.701..13722.765 rows=200 loops=1) Group Key: a.eventid Batches: 1 Memory Usage: 225kB -> Hash Join (cost=1.53..366307.93 rows=258798 width=8) (actual time=12.252..13470.181 rows=1293738 loops=1) Hash Cond: (a.actionid = aa.actionid) -> Index Scan using alerts_3 on alerts a (cost=0.43..362829.23 rows=776395 width=16) (actual time=1.459..13091.248 rows=1293738 loops=1) Index Cond: (eventid = ANY ('{1917584,1917589,1917612,1918247,1918707,1918711,1919871,1919876,1919885,2646854,3512704,3515337,3529042,3529051,3529745,3529764,3529873,3529875,3560887,3589542,3601809,3601815,3601819,3601820,3601821,3601824,3601841,3601850,3610947,3614349,3646525,3646533,3646554,3646733,3646737,3653434,3653438,3653594,3653599,3653605,3653826,3653834,3653835,3653849,3653854,3653857,3653858,3653862,3653870,3653871,3653872,3653879,3653883,3653900,3653926,3653936,3653949,3653965,3653979,3654166,3654169,3654177,3654179,3654181,3654185,3654188,3654194,3654199,3654202,3654205,3654209,3654211,3654219,3695041,3695052,3695054,3695062,3695073,3695087,3695099,3695253,3695320,3695567,3695568,3695569,3695570,3695572,3698324,3698331,3712695,3718317,3718323,3753468,3753529,3753748,3755376,3763184,3763200,3763201,3763213,3763223,3763233,3763557,3763560,3763561,3763565,3763569,3763575,3763576,3763581,3763582,3763592,3763593,3763603,3763628,3763864,3763900,3763906,3819506,3820613,3862875,3862958,3863527,3863528,3864267,4018743,4018997,4108455,4115714,4504058,4555618,4589979,4591324,4591554,4591651,4592106,4708825,4708945,4711388,4720657,4751732,4751745,4752648,4778674,4821761,4880979,4880988,4880990,4882066,4882067,4882068,4887041,4887043,4887067,4887068,4936352,4954130,5020710,5021499,5021668,5022132,5081539,5155512,5233902,5293166,5293991,5294069,5294995,5298746,5302504,5305133,5333688,5382465,5406479,5457728,5461430,5466239,5473127,5480011,5481550,5499977,5501464,5502227,5505308,5506071,5506168,5508009,5513491,5513649,5518069,5518425,5519075,5521626,5522590,5522802,5523501,5523626,5523699,5524008,5524046}'::bigint[])) -> Hash (cost=1.07..1.07 rows=2 width=8) (actual time=10.752..10.753 rows=2 loops=1) Buckets: 1024 Batches: 1 Memory Usage: 9kB -> Seq Scan on actions aa (cost=0.00..1.07 rows=2 width=8) (actual time=10.742..10.745 rows=2 loops=1) Filter: (eventsource = 0) Rows Removed by Filter: 2 Planning Time: 2.931 ms JIT: Functions: 19 Options: Inlining false, Optimization false, Expressions true, Deforming true Timing: Generation 1.766 ms, Inlining 0.000 ms, Optimization 0.890 ms, Emission 9.580 ms, Total 12.236 ms Execution Time: 13744.217 ms (18 rows)