Optimizing “random” choice in PostgreSQL
I have the following table CREATE TABLE article ( id bigserial PRIMARY KEY, text TEXT NOT NULL, category_id bigint REFERENCES categories (id), status TEXT NOT NULL, locale TEXT NOT NULL, source TEXT...
View ArticleUsing postgres with logstash – log filename is causing issues
I’m having some trouble forwarding postgres logs to logstash. Normally it’s pretty easy to do, but the problem with postgres is that the current logfile has the current date in the filename, so the...
View ArticleOne connection vs multi connection
I’m redesigning my client’s website in order to add about 16 mini sites for their web site. It’s a website using PostgreSQL. And my question is: Performance wise, what is the better database design: 1...
View ArticleTrouble with group by on multiple column
For debugging purpose, i’m computing stocks of my application in order to be able to update them to the right values or to compare with current value. My objects are built as follow : location which...
View ArticleSELECT very slow when no results and a LIMIT is specified
I am running into an issue where a SELECT query is very slow because it does not use an index when the number of final results is 0 and a LIMIT clause is specified. If the number of results is greater...
View Articlepg_dump fails to create a backup when running from System User in Windows...
I am trying to run a pg_dump through a scheduled task in windows. I have two batch files. One creates the task. The other one runs the pg_dump. Even though the pg_dump works with the current user with...
View ArticlePostgres 9.4 to 9.5 using Yum and pg_upgrade – CentOS 6.7 (Final)
I am attempting to do an upgrade between Postgres 9.4 to 9.5 on a CentOS 6.7 system. I have reviewed both:...
View Articledatabase Deadlock again
Once again I have a deadlock problem with the following log: [17/03/16 16:42:20.020 -0300] FATAL OPERACIONES: SQLException: CreateEquipo: ERROR: deadlock detected Detail: Process 2923 waits for...
View ArticleResetting deadlock count statistics
It seems that just restarting the PostgreSQL service doesn’t clear / reset the detected deadlock count. How can it be restarted to zero? select version(); PostgreSQL 9.4.5 on x86_64-unknown-linux-gnu,...
View ArticlePostgreSQL: Slow JOIN on three large tables
Edit: Proposed this question as a LEFT JOIN problem, but as @wildplasser pointed out, due to my WHERE clause I was actually doing a JOIN all along. Adjusting the question from LEFT JOIN to JOIN. The...
View Article