Bird
0
0

A growing app has a users table with millions of rows. You notice slow login queries filtering by username. Which combined approach best improves performance?

hard📝 optimization Q15 of 15
PostgreSQL - Performance Tuning
A growing app has a users table with millions of rows. You notice slow login queries filtering by username. Which combined approach best improves performance?
AStore usernames in a separate table without indexes.
BDrop all indexes and rely on sequential scans.
CAdd an index on <code>username</code> and analyze query plans regularly.
DIncrease server RAM without changing queries or indexes.
Step-by-Step Solution
Solution:
  1. Step 1: Identify indexing as key for fast lookups

    Adding an index on username helps queries find users quickly.
  2. Step 2: Use query plan analysis to maintain performance

    Regularly checking query plans helps spot slow parts and optimize further.
  3. Final Answer:

    Add an index on username and analyze query plans regularly. -> Option C
  4. Quick Check:

    Index + query plan analysis = best tuning [OK]
Quick Trick: Combine indexing with query plan checks [OK]
Common Mistakes:
  • Removing indexes causes slower queries
  • Ignoring query plan analysis
  • Relying only on hardware upgrades

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes