Postgres wont remove useless joins, when the UNIQUE index is partial

2019-01-10 Thread Kim Rose Carlsen
Hi remove_useless_join does not prove uniqueness if the unique index is partial, and therefore wont remove the join if no columns are referenced (see example in bottom). I have been trying to look around the source code and from what I have identified the problem seems to be that "check_index_

How to investigate what postgres is spending time on

2018-09-23 Thread Kim Rose Carlsen
Hi I have some simple INSERT / UPDATE queries, that takes a long time the first time they are run in out test environment, but I'm not sure what postgres is doing and what I can do to help it. Whats common is that the table contains many rows in the order of about 20 millions. Query: INSERT

Re: survey: pg_stat_statements total_time and entry deallocation

2018-09-11 Thread Kim Rose Carlsen
Here is some data from our production. I hope it can be of any use to you. - System 1: hiper=> select      bucket   ,count(*) entries   ,max(calls) max_calls   ,round(sum(total_time)) total_time   ,round((100*sum(total_time)/avg(total_total_time))::numeric,2) pc

Conflict between recovery thread and client queries on a hot standby replica

2018-09-09 Thread Kim Rose Carlsen
Hi It seems that the recovery thread(streaming replication) and sql queries against a postgresql hot standby can produce a deadlock. If you have conflicting statements running on master and slave, you can end up with queries on the slave waiting for locks of the recovery thread and the recov

Conflict between recovery thread and client queries on a hot standby replica

2018-09-09 Thread Kim Rose Carlsen
Hi It seems that the recovery thread(streaming replication) and sql queries against a postgresql hot standby can produce a deadlock. If you have conflicting statements running on master and slave, you can end up with queries on the slave waiting for locks of the recovery thread and the recov