r/mysql • u/Big_Length9755 • Aug 05 '26
question Guidelines and best practices
Hi Experts,
I understand every database is diferent architecturally. We have mostly worked in Oracle databases in the past. But we recently started working in Mysql aurora database.
1)So, want to understand , if there exists any set of guidelines which we can follow as a developer for writing better optimized code/sqls in mysql?
2)Also any specific points which are special and different as compared to other DB's and thus we should definitely know in this case before designing any solution using mysql?
3
Upvotes
2
u/alecc Aug 06 '26
At 100-200M rows/day the thing that will hurt first is retention - partition the big tables by day and drop partitions when data ages out, a DELETE based purge at that volume means huge binlog churn and replica lag, and InnoDB never returns the space without a rebuild anyway. The other big shift from Oracle is the optimizer: MySQL is nested loop joins first (hash join only since 8.0.18), no bitmap indexes, no materialized views, no parallel query out of the box - so your 1-2s UI target on tables that size means every query needs an index designed for it, covering where possible. Aurora specifics worth checking: which line you're on (Aurora MySQL 3 is 8.0 compatible and gets CTEs, window functions and hash joins, the 5.7 compatible line gets none of that) and whether Aurora Parallel Query is available for your instance class, it has real restrictions.
1
u/roXplosion Aug 05 '26
Can you describe the basic structure of the DB, and a rough idea of the scale you're looking at?
2
u/Several9s Aug 12 '26
Given that you're coming from Oracle and moving to Aurora MySQL 8.0.39, I would focus on a few MySQL-specific areas rather than trying to create a long list of generic SQL rules.
With 5–6 large OLTP transaction tables potentially receiving 100–200M+ rows/day, a 1–6 month retention period, and a 1–2 second UI response target, I would pay particular attention to these:
WHERE,JOIN, andORDER BYpatterns, and useEXPLAIN/EXPLAIN ANALYZEto see what MySQL is actually doing. This will be important for the 1–2 second UI response target.DELETEoperations when old data needs to be removed.Since you're on Aurora, I'd also make sure the team is familiar with Performance Insights and the available Aurora monitoring. Use the actual workload to identify where the database is spending time instead of optimizing everything prematurely.
One final point: 1–2 seconds should be defined per query/use case, not just as a general database target. Identify the critical UI operations and establish an expected execution time for each. Then make those queries part of your performance/regression testing.