It made me realise: you can tune queries all day, but if your parameters are off, the whole DB can still crawl π¦.
β‘ Takeaway: Query optimisation helps individual queries. Parameter Groups improve the entire database. Both matter β but parameters are the real foundation.
π‘ Recently, I was working on optimising some queries for better DB performanceβ¦
I did all the usual things:
β Removed SELECT *
β Added the right indexes
β Used EXPLAIN ANALYZE to tune execution plans
These settings decide how the database engine itself behaves β memory allocation, caching, parallelism, connections, etc.
Some eye-openers for me:
work_mem β memory per sort/join
shared_buffers β how much RAM goes into caching
max_connections β stability under heavy load
π Redis: The Secret Sauce for Lightning-Fast Applications
I recently learned about Redis, and it's truly a game-changer for speeding up applications.
π‘ Caching: The Key to Speed
Before Redis vs. After Redis:
4. user.repository.js π¦
This layer deals with data access. πΎ
Whether itβs fetching data from a database or an API, this is where it happens.
It separates concerns and makes everything readable!
π I recently discovered an effective and clean approach to structuring code. Small improvements make us better developers! π§΅
1. app/user
Inside this, we separate responsibilities neatly:
user.routes.js π
Handles Authorization, Authentication, and routes. Clean and simple!
3. user.service.js π§
This is where the business logic lives.
Important: It should not contain any logic for fetching data from the DB.
It keeps your code modular and testable!
Next stop, repositories βοΈ