Re: zabbix on postgresql - very slow delete of events

2019-07-24 Thread Maxim Boguk
On Wed, Jul 24, 2019 at 6:12 PM Kristian Ejvind wrote: > Hi Maxim > > > > Thanks for your advice, and let me start with your second email, which > I'll copy here: > > > > = > > Hi Kristian, > > > > After comparing structure of zabbix tables with same in my zabbix > installation I found one

Re: zabbix on postgresql - very slow delete of events

2019-07-24 Thread Kristian Ejvind
Hi Maxim Thanks for your advice, and let me start with your second email, which I'll copy here: = Hi Kristian, After comparing structure of zabbix tables with same in my zabbix installation I found one very weird difference. Why type of events.eventid had been changed from default bigint

Re: zabbix on postgresql - very slow delete of events

2019-07-24 Thread Maxim Boguk
> > > All these queries execute well below 1 ms, using indexes. > > > > Let's delete one row. See explain results here: > https://explain.depesz.com/s/aycf . 5 seconds to delete a single row, > wow! > > This shows that it is the foreign key constraints on event_recovery and > alerts that take a

Re: zabbix on postgresql - very slow delete of events

2019-07-24 Thread Maxim Boguk
Hi Kristian, If you look for explain analyze results for delete, you will see that 99% of time query spent on the foreign key triggers checks. In the same time the database have indexes on foreign key side in place. I recommend try this: \timing on BEGIN; delete from zabbix.events where

Re: zabbix on postgresql - very slow delete of events

2019-07-24 Thread Kristian Ejvind
Hi. Well, the events table has both a primary key and foreign keys referencing it, which is not possible on a partitioned table in postgresql 10. How did you work around this issue? On the other hand, if we can get the deletion of rows from the events table run at normal speed, I can't imagine