nix When the Nix Eval Cache Serves You a Ghost Derivation Postgres kept booting on port 15433, but my config said 15432. I grepped the entire repo for 15433 and found nothing. The number didn’t exist in any file I had edited, yet there it was, running, confident, every single time.
postgresql The Filter in the Wrong Place: 76x Faster by Moving One WHERE Clause A payments API ranked every transaction in the table before throwing most of the rows away, because the account-name filter ran after the window function instead of before it.
nix Configure max_connections for PostgreSQL using nix How to configure max_connections value for PostgreSQL using nix
postgresql Deleting stale Postgres wal files I was debugging a system earlier today, where one of the postgres instances ran out of disk space, and taking a closer look at the system, I realised that the backup command was failing silently, but the postgres archive files was still being retained in the wal folder. Checking a
postgresql Finding long running SQL queries in PostgreSQL Recently in one of the projects that I was working on, I came across a situation where the SQL query times was getting slower and slower per day, and I had to figure out what was happening to the system. One of the things that I checked immediately was whether
postgres Don't forget to update the sequence in PostgreSQL after a COPY command You might have noticed that after bulk inserting records using the COPY statement in PostgreSQL the sequence IDs are not getting updated for any further inserts later on, and it would throw duplicate sequence ID errors. So you would be wondering what makes this COPY statement different that it does
postgresql Copy data from one postgres instance to another. remote copy options explored: Copy, CSV and STDIN Various options to copy data from one Postgres database/table to another Postgres database or table using copy command.
postgresql Escape character sequence "E" in PostgreSQL explained What's the "E" before a Postgres statement mean? Explaining the postgreSQL escape character sequence.
rails How to turn on SQL debug logging for ActiveRecord If you want to see the SQL queries that your apps are running and want o optimize them or tune them, then it is a nice idea to log them. You can either log it to your log file or even to STDOUT. You can set the log level in
ruby Connecting Ruby & Active Record Without Rails require 'active_record' require 'mysql2' # or 'pg' or 'sqlite3' # Change the following to reflect your database settings ActiveRecord::Base.establish_connection( adapter: 'mysql2', # or 'postgresql' or 'sqlite3' host: 'localhost', database: 'your_database'
postgres Postgresql: How to find pg_hba.conf file using Mac OS X To find the postgresql config file we can use the locate command. Type the following in your terminal: locate pg_hba.conf Or else: If you have a postgres server running on your machine, you can find the config directory using the following command ps aux | grep postgres which would
postgres Dump PostgreSQL without owner and privileges If you ever wanted to dump your postgres development database without the owner and the privileges, then you just need to run the following command: pg_dump database_name -O -x > output_file
postgres Postgres could not connect to server $ psql psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.5432"? The reason for the issue is because a pid file was blocking postgres from starting up. To fix it: rm