Urgent.News

What's breaking now, across hundreds of outlets.

Tech

PostgreSQL Redundant Indexes: Is an Index on (a) Redundant When You Have (a, b)?

Disclosure: I build Schemity , a desktop ERD tool - this post is from our blog and uses it for the examples. TL;DR: A plain b-tree index on (a) is redundant when another b-tree index starts with a , such as (a, b) : PostgreSQL 18.3 served the same lookup from the wider index with the same number of heap reads. Do not drop it on that rule if it is UNIQUE , uses a different operator class or has…

A PostgreSQL b-tree index on a single column, such as (a), can be redundant when another b-tree index starts with that column, like (a, b). In PostgreSQL 18.3, the wider index served the same lookup as the narrower one, requiring the same number of heap reads. Therefore, it is not necessary to maintain both indexes in such cases.

However, there are exceptions where the narrower index has unique characteristics that make it valuable, such as being a UNIQUE index, using a different operator class, or including additional columns that the wider index does not. It is advisable to evaluate each index individually, rather than relying solely on the presence of a wider index with the same leading column.

Rewritten by urgent.news; may contain errors — check the original.

Source: dev.to

Read the original at dev.to →

Report a problem with this story

More in Tech

PostgreSQL Schema vs Database: Which Should Separate Your Modules or Tenants?

Disclosure: I build Schemity , a desktop ERD tool - this post is from our blog and uses it for the examples. TL;DR: Use schemas to separate modules that still reference each other: a foreign key, a…

  • Separate schemas within one database for modules with interaction.
  • Use separate databases for modules that must never share resources.
  • Schemas are faster to create than databases, but migration is more efficient with schemas.

How do you price a change request? New work + knock-on rework + timeline cost

To price a change request, add the hours for the new work to the hours of rework it causes in already-finished work, multiply by your rate, then add any timeline cost: (new_work_hours +…

  • New work hours: Estimate task in design, build, content creation, review, deployment
  • Knock-on rework hours: Account for impact on existing work, adjust layouts, update navigation
  • Timeline cost: Include overtime, contractors, or delayed deadlines, add 20% rush premium

More from Sunday, 29 November 2026 →