TryGhost / Ghost

Independent technology for modern publishing, memberships, subscriptions and newsletters.
https://ghost.org
MIT License
46.22k stars 10.1k forks source link

Added composite index to posts table for type,status #20437

Closed 9larsons closed 1 week ago

9larsons commented 2 weeks ago

ref https://linear.app/tryghost/issue/CFR-35

The posts table is shared by posts and pages and seldom is queried for both. It makes sense to add an index on type, and from the perspective of the content API, also on status as you're almost only ever querying for published posts or published pages.

github-actions[bot] commented 2 weeks ago

It looks like this PR contains a migration 👀 Here's the checklist for reviewing migrations:

General requirements

Schema changes

Data changes

9larsons commented 2 weeks ago

Index is added in a few ms for a test set of 20k posts. This may be a bit longer for the couple biggest customers - I think the largest has ~125k posts, but all in all is very quick.