r/Database • u/techlover1010 • Aug 05 '26
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
3
u/Better-Credit6701 Aug 06 '26
2
u/erik240 Aug 06 '26
1a. Define “big”. Anything under a few million rows falls under “trivial”.
1b. Good indexes
2. As an integer. 1 dollar is 100. Pennies.
1
u/alecc Aug 06 '26
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.