Fast seralizable transactions starving slower ones

2018-06-06 Thread Viktor Fougstedt
Hello! We have a system with a lot of integrity constraints that are not easily expressed as SQL constraints. We therefore run all writing transactions in serializable isolation, so that our code can make SELECT:s to check the constraints. We’ve run in to a, well, it’s not a “problem”, becaus

Re: Given a set of daterange, finding the continuous range that includes a particular date

2018-02-23 Thread Viktor Fougstedt
Hi. This answer is perhaps useful if I understand your problem correctly. But I might have interpreted it wrongly. :-) I would probably start with merging intervals so that overlapping and adjacent intervals become single continuous intervals, then select from those merged intervals. We hav

Incredibly slow queries on information_schema.constraint_column_usage?

2018-01-12 Thread Viktor Fougstedt
Hello! We have a program which auto-generates tables and constraints, run against PostgreSQL 9.5. On startup, the program checks the current database schema to detect changes that are needed. For one of our database servers, some selects from information_schema are incredibly slow: select co