Angry Birds soar to new heights with a million downloads on Android! – http://bit.ly/dD3kzY
After watching Return of the M…
After watching Return of the Magnificent Seven last night – I can wholeheartedly say there’s a sequel that was 100 levels below the original
Had my first cup o joe from th…
Had my first cup o joe from the keurig. Timothys mocha java ain’t too shabby – not bitter and some actual boldness to it
How to Watch the Super Harvest…
How to Watch the Super Harvest Moon Twilight Show Today http://t.co/KY75p6I via @gizmodo
mySQL – Mutli Column Index
Ok, more of a note for myself in case I forget this in the future…While further researching mySQL database optimization, I’ve come across the idea of a “multiple-column index“. That is, you create an index in mySQL and define the index as col A, col B, etc, instead of individual indices of col A and col B.
So, if you have a query that you are always going to involve the same (or at least a portion of the same) WHERE clauses, you can define an index that groups them all together. Using the example from the mySQL page,
SELECT * FROM tbl_name WHERE col1=val1;
SELECT * FROM tbl_name WHERE col1=val1 AND col2=val2;
SELECT * FROM tbl_name WHERE col2=val2;
SELECT * FROM tbl_name WHERE col2=val2 AND col3=val3;
…you define an index on (col1, col2). The first two queries will utilize that index. The important piece to note is that the bottom two queries will NOT use that index, because the WHERE clause must include the left most column in the index. So, why create a multi-column index to begin with. Well, I’ll pass it on right from the horse’s (aka MySQL’s) mouth…
If a multiple-column index exists on
col1and
col2, the appropriate rows can be fetched
directly. If separate single-column indexes exist on
col1andcol2, the
optimizer will attempt to use the Index Merge optimization (see
Section 7.3.1.4, “Index Merge Optimization”), or attempt to find
the most restrictive index by deciding which index finds fewer
rows and using that index to fetch the rows.
mySQL – To NULL or NOT to NULL
Ok, really the question is whether to use NULL or NOT NULL, but NOT to NULL, was just more Shakespearean. As I update one of my commercial PHP scripts, I’m looking to optimize it as much as possible for the end customers. So, among the bazillion of performance enhancing script decisions to be made, is whether to leave your mySQL columns as NULL or NOT NULL.
The general rule of thumb is you leave it as NULL for fields in your table that don’t really need to be filled. For example, if you had a User table, and ‘eye color’ was just an optional field, you could leave that at the default, or NULL value. If you set that field to NOT NULL you would be forcing that field to have some value, even if the value is empty string.
Now, I could simply set all fields to NOT NULL and default it to an empty string. Then I would not have to deal with NULLs, and just deal with empty string checks, which some may prefer. But, what is the performance hit of doing that? By setting it to NOT NULL you are telling mySQL that you need to make some space for this value, and even an empty string takes up some space. After much Googling, I’ve pretty much come to the conclusion that the space taken up by the empty string is negligible for most folks, and really isn’t a concern or point of debate in the NULL vs NOT NULL decision.
So, what to do – and here’s the answer, do whatever works best for you in your situation and ignore any minute performance/size issues. If you want to follow strict database paradigm, use NULL for place where you want to know that no value has been entered. So, if the user chose to not fill out their eye color in the above example, the resulting mySQL field value would be NULL.
There you have it – clear as mud
.
Here’s the mySQL docs on NULL.
Get Angry Birds Lite Beta2 for Android

Angry Birds Lite Beta2 for Android was just released to the market. Time to check out the changes that beta 2 brings.
Also available at getjar (though currently page still lists 1.3.5, but Rovio says to get it from getjar, so I assume its the latest version and the page just hasn’t been updated yet.)
There’s no new levels – just bug fixes – but, the quicker they squash the bugs, the quicker we get the final version with more levels!
