Question : I have 3 tables, leads, lead_addresses and addresses. Scheme looks like this: recently we decided that foreign keys […]
Tag: postgresql-9.6
Query to get counts of values per column
Question : I have a big table of vendor-supplied data (that I can’t change around much) with about 315 columns. […]
Conflict resolution for hash-backed unique constraint of large text bodies
Question : So we’ve just run into ERROR: index row size 2736 exceeds maximum 2712 for index “foo__bar__un” Hint: Values […]
How to use pg_archivecleanup on Windows
Question : Trying to figure out a proper way to clean old WAL files located in archive directory for point […]
Calculate difference between SUM over last 30 days and the SUM for 30 days preceding this period (days 30-60) in Postgres
Question : Every day we store the number of jobs posted for hundres of thousands of companies. We need to […]
GRANT SELECT ON SEQUENCE succeeds, but to no effect?
Question : I am trying to grant select access to sequences from one user/role to another. There are no errors […]
Permission denied on function after schema copy
Question : I had one schema ‘public’ and simple function in the schema named ‘isvalidoption’. What was done: backup schema […]
pg_restore “CREATE CAST” not executed if using public or pg_catalog schemas
Question : While moving database to another instance I’m using pg_dump and pg_restore with intermediate file. Dump file was created […]
SELECT DISTINCT ON, ordered by another column
Question : Please consider the following table test: CREATE TABLE test(col1 int, col2 varchar, col3 date); INSERT INTO test VALUES […]
Postgres sometimes uses inferior index for WHERE a IN (…) ORDER BY b LIMIT N
Question : We have a PostgreSQL table with ~5 billion rows that has developed a nasty habit of missing the […]