Monday, June 20, 2011

Disk upgrade

As my old DELL has become slow to boot, started to crank the disk randomly for a long period of time and freezing during this time, I decided to try out an SSD like other people in the group. My laptop was blazing with SSDs, but it lasted for about 3 months as the SSD crashed one day.

So I decided to try out a 7200 RPM disk as the old one was 5400 RPM.

I went ahead and imaged the new disk and also collected manual stats for a normal reboot with no new applications installed. I did not want to use a tool to benchmark before and after as it would tell me the stats, but not how it feels like. So I picked up my phone, paper and pencil and then started the timer.

Here are the stats for a DELL latitude – D620

                                   5400-RPM 7200-RPM

Dell boot appears                   0         0

Windows XP boot screen disappears  27        21
Blue background appears            54        38
Welcome to Windows, login screen   76        54
appears


Entered username and password       0         0
while timer is reset with
left hand.
Custom background picture           6         1
appears                                     
Quick launch bar appears           38        33
Desktop flashes after loading      83        48
all the icons
Disk activity                      183       Stopped.
                                  Still

Monday, June 6, 2011

SQL pitfall ('NOT IN')

It was frustrating recently to see that the following simple SQLs behave fundamentally different though one result was supposed to be the negative of the other.

-- Lists emloyees present in the tmp table.
select * from empl empl
where empl.empl_id in (select empl_id from tmpTable);

-- Expected to list the employees that are not present in the tmp table
-- Very similar to the above query, but using 'not in' construct.
select * from empl empl
where empl.empl_id not in (select empl_id from tmpTable);

No results were returned from this query though a number of records were expected to be returned.

After digging into the basics and spending quite a bit of time googling, a record with null emloyee id was found in the tmpTable, which originated from the CSV source file used to populate this table.

So I put in a filter 'where empl_id is not null' for second query (based on 'not in') alone. Realized that I should have used 'not exists', and would have avoided this pitfall.