Tag: php
-
DIGG: 4000% PERFORMANCE INCREASE BY SORTING IN PHP RATHER THAN MYSQL
To scale at Digg they followed a set of practices very similar to those used at eBay. No joins, no foreign key constraints (to scale writes), primary key look-ups only, limited range queries, and joins were done in memory. When implementing the comment feature a 4,000 percent increase in performance was created by sorting in…
-
How To: Exclude Words Like “An, A, The” From Alphabetized MySQL ORDER
When ordering lists of names or titles it’s sometimes desirable to exclude articles or other words from the order clause (eg. you want “The Burning Hell” to show up before “Great Lake Swimmers” in a list ordered by name). Early on in my career I must have assumed it was not possible and never bothered…
-
How To Round Unixtime To Midnight
This might be pretty obvious to anyone with basic math skills. It took me a few minutes to figure out, so I thought I’d share with the world. To round a unix timestamp to the previous midnight (UTC) use the following function: function unixtime_round_to_midnight ($t) { return $t – ($t%86400); } Thanks to Ian for…