5 Posts Tagged ‘postgresql’

(All tags.)

Migrate PostgreSQL ID’s from serial to identity after upgrading to Django 4.1

Let me regale you with the ballad of the serial to identity column migration…

The Django 4.1 release notes feature this short, innocent-looking note:


How to optimize PostgreSQL queries from Django using pgMustard

Well, that cuts the mustard.

Slow queries happen, and when they do, it can be tough to dissect why they’re slow. This difficulty is compounded by using Django’s ORM, since it generates the SQL for you, so you may have little idea of the actual queries “under the hood”.


How to Find and Stop Running Queries on PostgreSQL

Owl be stopping those pesky queries!

Your PostgreSQL server is seizing up, with some naughty queries consuming too many resources or blocking others. Don’t panic! You can stop those problem queries and stabilize your system.


Reindexing all tables after upgrading to PostgreSQL 13

Non-helpful diagram.

I recently upgraded my client ev.energy to PostgreSQL 13. The first feature listed in this version’s release notes is “Space savings and performance gains from de-duplication of B-tree index entries”. I reindexed all tables after the upgrade to take advantage of this deduplication and saw index storage savings of up to 90%.


SQL’s Implicit Type Conversion

Birds of a feather convert together

At yesterday’s DJUGL meetup I heard a talk from Esau Rodríguez about a buggy new system deployment he survived. His team were deploying a new version of a system that changed the way it connected to its MySQL database, while simultaneously moving session keys from integers to UUID’s. When they discovered the database connection change was flaky, they rolled back to the previous version. This quickly lead to a user reporting being able to see another’s data!