Quantcast
Channel: Joel on SQL
Browsing all 25 articles
Browse latest View live

Image may be NSFW.
Clik here to view.

Hasta la vista, SQL_ASCII

Converting the encoding of your production database from SQL_ASCII to UTF8 can be a tricky challenge if you cannot accept any down time. The method presented here scans through all rows with...

View Article


Image may be NSFW.
Clik here to view.

Add indexes without slowing down writes

I find myself facing a particular dilemma quite often. Should I keep this rarely used index or drop it to enhance write performance? If the index isn’t used at all, it’s no problem, just drop it, but...

View Article


Image may be NSFW.
Clik here to view.

Call PostgreSQL functions via HTTP JSON-RPC

Everytime I deploy a new stored procedure, it bothers me I have to update the middle-layer to allow my front-end code to use the function. My middle-layer between the front-end code and the database...

View Article

Image may be NSFW.
Clik here to view.

Deploying PostgreSQL Stored Procedures

When you mention stored procedures, I see horror and disgust in the eyes of many developers. “Stored Procedures are like crack, they are addictive and harmful.” I agree they are addictive, but harmful?...

View Article

Image may be NSFW.
Clik here to view.

PostgreSQL 9.3devel – plpgsql_check_function

One of the biggest incompatibility issues between 9.x and 8.4 is the new behavior of PL/pgSQL functions where parameter names are in conflict with columns. In 8.4, PL/pgSQL silently use the value of...

View Article


Image may be NSFW.
Clik here to view.

Foreign Key Locks

In August 2010, I sent an email to pghackers reporting a strange deadlock problem. I couldn’t understand how it was possible you could get a deadlock by updating the very same row again later in the...

View Article

Image may be NSFW.
Clik here to view.

Production upgrade from 8.4 to 9.1

At Wednesday, 2012-08-15 05:00 am, the work began. Four hours of downtime later at 09:00 am the upgrade was complete. Two brand new identical HP DL380 Gen8 servers with 400GB SSD-disks and 192GB RAM...

View Article

Image may be NSFW.
Clik here to view.

Announcing the pci-blackbox: PCI-DSS compliant system with 3-D Secure...

The pci-blackbox aims to simplify the process of becoming PCI-DSS compliant, by handling card data in an isolated system, physically and logically separated from the rest of the system. The idea comes...

View Article


Image may be NSFW.
Clik here to view.

Will PostgreSQL 9.5 Bring Back Moore’s Law?

I just watched a presentation from Mar 11, 2012, where Paul Graham / YCombinator is giving away seven billion dollar startup ideas: A New Search Engine Replace Email Replace Universities Internet Drama...

View Article


Image may be NSFW.
Clik here to view.

Secure deployment of PostgreSQL functions

Two people might be simultaneously modifying the same database function. To protect against this scenario, I created a little tool to stage the source code of all functions in pg_proc and the...

View Article

Image may be NSFW.
Clik here to view.

Securing PostgreSQL using hostssl cert clientcert=1

This is not the first time I’ve struggled getting SSL certificate validation to work, so I thought this time I better write down how I did to avoid future time-waste. For security and convenience...

View Article

Image may be NSFW.
Clik here to view.

PL/pgSQL #1 annoyance

I cannot count the number of times I’ve written the same stupid code, just to do something as simple as making sure the UPDATE updates exactly one row. Last time I complained about this in public was...

View Article

Image may be NSFW.
Clik here to view.

::xml madness

Nobody likes XML, except masochists and Microsoft consultants who charge by the hour. Sometimes you are forced to deal with XML anyway, such as parsing the response from external APIs. Parsing XML is...

View Article


Image may be NSFW.
Clik here to view.

Fun with pg_catalog.pg_depend

Learning PostgreSQL and SQL in general probably begins with the concept of TABLES. Then probably VIEWS, INDEXES and maybe TRIGGERS. Some users might not ever go any further, which is sad, because there...

View Article

Image may be NSFW.
Clik here to view.

Inofficial PgParty Stockholm

Friday the 28th of June we will be celebrating the awesomeness of PostgreSQL and having the pleasure of welcoming everyone who can exploit the guest list and manage to INSERT their name into it. This...

View Article


Image may be NSFW.
Clik here to view.

PostgreSQL 9.3devel – plpgsql_check_function

One of the biggest incompatibility issues between 9.x and 8.4 is the new behavior of PL/pgSQL functions where parameter names are in conflict with columns. In 8.4, PL/pgSQL silently use the value of...

View Article

Image may be NSFW.
Clik here to view.

SET search_path for all SECURITY DEFINER functions

As pointed out by Peter Eisentraut in a blog post named Schema Search Paths Considered Pain in the Butt, you need to make sure the search_path is explicitly set for all SECURITY DEFINER functions in...

View Article


Image may be NSFW.
Clik here to view.

Garbage Collection of Unused PostgreSQL Tables and Columns

Over the last five years, our database at Trustly have kept growing in number of tables, columns and functions, where some of the tables and columns aren’t being used by any database functions any...

View Article

Image may be NSFW.
Clik here to view.

psql \watch 1400000000 epoch time countdown counter

SET TIMEZONE TO 'UTC'; \t \a \pset fieldsep ' ' SELECT (('epoch'::timestamptz + 14*10^8 * '1 s'::interval)-now())::interval(0), (14*10^8-extract(epoch from now()))::int, extract(epoch from now())::int...

View Article

Image may be NSFW.
Clik here to view.

“How we use PostgreSQL at Trustly” at PGConf.EU

Slides from my talk, How we use PostgreSQL at Trustly, are now available.

View Article
Browsing all 25 articles
Browse latest View live