8 Posts Tagged ‘postgresql’

(All tags.)


PostgreSQL: Full text search with the “websearch” syntax

PostgreSQL’s powerful full text search feature supports several query syntaxes. Of these, a website search feature should typically pick the websearch syntax. websearch copies some features from popular search engines, as covered below, offering familiar short syntax to users. It is also forgiving and will never raise a syntax error for user input, whilst other syntaxes can.

Read more...

Django: Maybe disable PostgreSQL’s JIT to speed up many-joined queries

Here’s a write-up of an optimization I made in my client Silvr’s project. I ended up disabling a PostgreSQL feature called the JIT (Just-In-Time) compiler which was taking a long time for little benefit.

Read more...

How to migrate from Django’s PostgreSQL CI Fields to use a case-insensitive collation

If you upgrade to Django 4.2, you may see system check warnings like:

Read more...

Migrate PostgreSQL IDs from serial to identity after upgrading to Django 4.1

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

Read more...

How to optimize PostgreSQL queries from Django using pgMustard

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”.

Read more...

How to Find and Stop Running Queries on PostgreSQL

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.

Read more...

Reindexing all tables after upgrading to PostgreSQL 13

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%.

Read more...

SQL’s Implicit Type Conversion

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 UUIDs. 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!

Read more...