IPs and ranges saved in strings in SQL #54
Labels
No Milestone
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: ppfun/pixelplanet#54
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
IPs and CIDR are saved in strings in the database, which is bad for performance and does not allow us to do calculations (like if an IP is in a given range) on the sql server.
IPv4 is binary(4) and IPv6 is binary(16) (128bit), which means we also have to split into sperate tables for v4 and v6.
Which now introduces super ugly issues in relations. i.e. if the user table links to the most recently used IP, we need a column telling us if its v4 or v6 it points too.
Or we store IPv4 as IPv6. Which causes it to take four times more space than needed (but still less than a string), but is the easiest to deal with.
Or we do that, but also drop half of the IPv6, and store in binary(8), which is 64bit.
Which would be our own weird format, but most suitable, because we do not care about the last digits.
Current IPInfo table takes multiple seconds to query with its >2 million rows of inefficiently saved data.
Biggest performance issue of the game currently.