Imagine a system that uses large-ish hex string identifiers, e.g. similar to UUIDs. To make the math easy, lets say we make a table with a million have 20 character IDs: create table ids1 (id cha...
The rise of “platform” sites (e.g. Heroku) enables developers to build and deploy web applications cheaply, without understanding operational problems. Typically these products let you purcha...
The following query finds all tables in a schema, ordered by row count: SELECT sysobjects.* , sysindexes.Rows FROM sysobjects INNER JOIN sysindexes ON sysobjects.id = sysindexes.id WHERE type = '...
Liquibase is a tool for managing database schemas (e.g. diffing schemas and writing migration scripts), and supports most major commercial and open-source relational databases. I’ll show how to...
Implementing Auditing Storing every change to an application’s database allows for sophisticated forensic analysis- usage trends over time, as a long-range debugger or for implementing data cor...
I saw a talk by some operations engineers who work for ARIN at PGConf 2014. They presented their architecture for high availability, which uses CMAN, Corosync, and Pacemaker, which handle message...
Tuning SQL queries is a useful skill, and while many people struggle to manage complex SQL, the work is actually a series of simple tricks. For instance, refactoring a query often brings about al...
Setup I’ve set up several scenarios to see how Postgres handles querying multiple full-text indexes. To demonstrate these scenarios I set up the following table and indexes, which has 1.1 milli...
For this test, I set up a 1.1 million row table1 using data from github2. If you’re not familiar with full-text in Postgres, they use the @@ operator to apply a query to a document3, which look...
When I attempted to implement faceted search against a Postgres full-text index, I found I had issues getting Postgres (9.2) to pick up the index: CREATE INDEX search_idx2 ON data2 USING gin(to_t...