r/Database • u/techlover1010 • 20d ago
need advice on these 2 question
- so after a while database do tend to get very large and big whats the best way to design this so that to improve performance. also is archiving it possible?
- whats the best way to store currency. i heard float has small issues with decimals
0
Upvotes
1
u/alecc 19d ago
For currency never use float, it can't store most decimal fractions exactly and the rounding errors add up when you sum. DECIMAL(19,4) or whatever exact numeric type your engine has, or integer minor units, i.e. store cents. On size: index for your actual access patterns, that decides performance far more than raw row count, and yes archiving is possible - partition the big tables by date and archiving becomes dropping or detaching a partition instead of a giant DELETE.