Pyh.conf’25: a new PHP conference for the Russian-speaking community

Voting

: max(zero, nine)?
(Example: nine)

The Note You're Voting On

ir on ir id is at gm ai ld ot co m
17 years ago
Keep in mind that storing IP addresses inside of your database as integers (rather than 15 character strings in decimal format, or 8 character strings in hex format) is hundreds of times faster.

Take the typical case of a MySQL database doing a search for an IP address on thousands (or millions!) of rows; you're either doing a string compare for each entry, or an integer equation. If you do your indexes correctly, your lookups should be literally 100x faster using an INT rather than a VARCHAR.

Also note that an integer doesn't need to be escaped when passed to a database. :)

<< Back to user notes page

To Top