Skip to content
Web Design & Development

Database Indexes, Done Properly

Structures that let databases find rows quickly without scanning entire tables.

MediaScaleUp Editorial Team 2 min read 18 views
Database Indexes, Done Properly

The key figures

Lookups
indexes speed up filtering and sorting
Write cost
every index must be updated on writes
Composite indexes
column order matters
Query plans
show whether an index is used

Why this is worth getting right

Missing indexes cause slow queries as data grows, while excess indexes slow writes and waste space.

Do this, not that

Do

  • Index columns used in filters and joins
  • Check query plans before and after
  • Order composite index columns by selectivity
  • Remove unused indexes
  • Retest as data volume grows

Don’t

  • Indexing every column
  • Assuming an index is used
  • Ignoring write performance
  • Adding indexes without measurement

When to bring in help

Our advice Bring in help when queries slow down as tables grow.

Where this comes from

The figures and practices above come from the sources listed.

Working on something like this?

We take on Web Design & Development work for teams who want it done once, properly. Tell us what you are building and we will tell you honestly whether we are the right studio for it. Start a project.

Where to go next

Spotted something wrong? Report an error on this page. We correct on the page and say what changed.

All services

The work behind this article, and what it costs.

MediaScaleUp Editorial Team

Articles here are researched, written and checked by the MediaScaleUp studio team before they are published, and dated when they are reviewed.

Keep reading

More in Web Design & Development