Zabbix proxy processes history syncer and configuration syncer can update item_rtdata table at the same time, sometimes that behaviour leads to deadlock:
127835 ? S 448:03 /usr/sbin/zabbix_proxy: configuration syncer [synced config 275030365 bytes in 81.817207 sec, idle 600 sec] 127835:20210430:052831.402 [Z3005] query failed: [0] PGRES_FATAL_ERROR:ERROR: deadlock detected DETAIL: Process 64959 waits for ShareLock on transaction 1610869401; blocked by process 35622. Process 35622 waits for ShareLock on transaction 1610861197; blocked by process 64959. HINT: See server log for query details. CONTEXT: while updating tuple (8678,47) in relation "item_rtdata" [update item_rtdata set lastlogsize=13215979 where itemid=4817759; update item_rtdata set lastlogsize=12228184 where itemid=4817853; update item_rtdata set lastlogsize=15520660 where itemid=4818605; update item_rtdata set lastlogsize=15527388 where itemid=4818699; update item_rtdata set lastlogsize=15550667 where itemid=4818793; update item_rtdata set lastlogsize=12248851 where itemid=4818887; update item_rtdata set lastlogsize=13073357 where itemid=4818981; update item_rtdata set lastlogsize=15361752 where itemid=4819075; update item_rtdata set lastlogsize=13887891 where itemid=4819457; update item_rtdata set lastlogsize=13063279 where itemid=4819551; update item_rtdata set lastlogsize=14095578 where itemid=4819645; update item_rtdata set lastlogsize=13180563 where itemid=4819739; ....
127920 ? S 47:22 /usr/sbin/zabbix_proxy: history syncer #5 [processed 201 values in 0.014312 sec, idle 1 sec] 127920:20210430:052829.772 [Z3005] query failed: [0] PGRES_FATAL_ERROR:ERROR: deadlock detected DETAIL: Process 101748 waits for ShareLock on transaction 1610861197; blocked by process 64959. Process 64959 waits for ShareLock on transaction 1610869407; blocked by process 101748. HINT: See server log for query details. CONTEXT: while updating tuple (7974,72) in relation "item_rtdata" [update item_rtdata set lastlogsize=12379005,mtime=0 where itemid=4966526; update item_rtdata set lastlogsize=13169243,mtime=0 where itemid=4827071; update item_rtdata set lastlogsize=13207156,mtime=0 where itemid=5954656; update item_rtdata set lastlogsize=13173698,mtime=0 where itemid=4897443; update item_rtdata set lastlogsize=13218318,mtime=0 where itemid=6684365; update item_rtdata set lastlogsize=5586299,mtime=0 where itemid=6684366; update item_rtdata set lastlogsize=12274229,mtime=0 where itemid=7380422; update item_rtdata set lastlogsize=4965000,mtime=0 where itemid=7380423; ]