Files
system-design-101/data/guides/a-cheatsheet-on-database-performance.md
Kamran Ahmed ee4b7305a2 Adds ByteByteGo guides and links (#106)
This PR adds all the guides from [Visual
Guides](https://bytebytego.com/guides/) section on bytebytego to the
repository with proper links.

- [x] Markdown files for guides and categories are placed inside
`data/guides` and `data/categories`
- [x] Guide links in readme are auto-generated using
`scripts/readme.ts`. Everytime you run the script `npm run
update-readme`, it reads the categories and guides from the above
mentioned folders, generate production links for guides and categories
and populate the table of content in the readme. This ensures that any
future guides and categories will automatically get added to the readme.
- [x] Sorting inside the readme matches the actual category and guides
sorting on production
2025-03-31 22:16:44 -07:00

2.0 KiB

title, description, image, createdAt, draft, categories, tags
title description image createdAt draft categories tags
A Cheatsheet on Database Performance Concise guide to optimize database performance with key strategies. https://assets.bytebytego.com/diagrams/0062-a-cheatsheet-on-database-performance.png 2024-03-11 false
database-and-storage
database
performance

Database Performance Cheatsheet

Here's a cheatsheet on database performance:

1. Indexing

  • Purpose: Speed up data retrieval.
  • Considerations:
    • Over-indexing can slow down writes.
    • Regularly review and optimize indexes.

2. Query Optimization

  • Techniques:
    • Use EXPLAIN to analyze query plans.
    • Avoid SELECT *.
    • Write efficient WHERE clauses.

3. Connection Pooling

  • Benefits:
    • Reduces overhead of establishing new connections.
    • Improves response times.

4. Caching

  • Levels:
    • Application-level (e.g., Memcached, Redis).
    • Database-level (query cache).

5. Sharding

  • Definition: Distribute data across multiple databases.
  • Use Cases:
    • Handling large datasets.
    • Improving write performance.

6. Replication

  • Types:
    • Master-slave.
    • Master-master.
  • Purpose:
    • Read scaling.
    • High availability.

7. Hardware

  • Considerations:
    • Sufficient RAM.
    • Fast storage (SSD).
    • Adequate CPU.

8. Monitoring

  • Metrics:
    • Query response times.
    • CPU usage.
    • Disk I/O.

9. Normalization/Denormalization

  • Normalization: Reduces redundancy.
  • Denormalization: Improves read performance (trade-off with redundancy).

10. Partitioning

  • Types:
    • Horizontal.
    • Vertical.
  • Purpose:
    • Improve query performance.
    • Easier data management.