Friday, March 23, 2012

Increase performance by adding NONCLUSTERED INDEX

Got a call from a client reporting an issue that is randomly occurred. after looking into the log file, I found one method took over a min to complete. The code shows only a simple select statement with where clause on "sentby" column. This column is a "nvarchar" and the table itself has over 1 million records.

Here is what I learned when I trying to fix this issue:

1. use "varchar" instead of "nvarchar". only use "nvarchar" when you have different languages in the same column! if you look at the sql execution plan ( sql -> display estimated ececution plan), search "nvarchar" does an index scan and "varchar" does index seek. index seek is orders of magnitude faster than a scan!

2. no index is set on "sentby" column. It won't be an issue in the small table (sql does index scan on small table), but it will impact performance when data grows. I used the script below to add a NONCLUSTERED INDEX on this column.

CREATE NONCLUSTERED INDEX IDX_MyMessageTable ON dbo.MyMessageTable
(
SentBy
)

after the index is created, the 1 min search time is down to under a second.

Tuesday, February 28, 2012

XOOM stuck on dual core logo screen (how to fix)

My XOOM was stuck on the Moto dual core logo screen last night. Soft reset (Volumn up + Power) did not work. It reboot, then still stuck on the logo screen. I searched on the web and the popular solution is to reinstall the ROM (requires android SDK and ROM at moto dev site).

This is how I fixed my issue without installing the ROM (XOOM wifi only US edition):
0. take out the microSD card if you installed one in your XOOM!!!
1. reboot (Vol up + Power)
2. On start-up when you see the Motorola logo, press and hold the Volume Down key.
3. When you see the Android recovery text, press the Volume Up key to put XOOM tablet in recovery mode. After a few min, you should see a Green Android laying down with the triangle and an exclamation (Android recovery screen).
4. On the Android recovery screen, press and keep holding the Power button then press and release the Volume Up key. This will take you to the recovery screen with list of menus.
5. Using Volume Down key navigate to Wipe data / factory reset option and press Power button to select it.
6. Select Yes, delete all user data option using Power button
7. My XOOM is fixed this way. time to set up the account again.