Skip to content

Issue #37 - Create indexes on Postgres - #424

Open
Uliana-Karavatskaya wants to merge 1 commit into
FindFirst-Development:mainfrom
Uliana-Karavatskaya:issue-37
Open

Issue #37 - Create indexes on Postgres#424
Uliana-Karavatskaya wants to merge 1 commit into
FindFirst-Development:mainfrom
Uliana-Karavatskaya:issue-37

Conversation

@Uliana-Karavatskaya

Copy link
Copy Markdown

Issue number: resolves #37


Checklist

  • [✓] Builds on localhost
  • [✓] Builds/Runs in docker compose

What is the current behavior?

Queries filtering bookmarks and tags rely only on primary key indexes. Frequently used search patterns (user_id, user_id + url, user_id + tag_title, tag_id) are not covered by indexes, which can lead to sequential scans and slower query performance on larger datasets.

Added database indexes to optimize frequently used lookup queries:

  • bookmark(user_id, url)
  • bookmark_tag(tag_id)
  • tag(user_id, tag_title)
    Added a Flyway migration to apply these indexes.

Does this introduce a breaking change?

  • Yes
  • [✓] No

Other information

The indexes were verified after migration. On the current development database, PostgreSQL may still choose sequential scans because the tables contain very little data. EXPLAIN confirms that the new indexes are available and can be used by the query planner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Indexes on Postgres

1 participant