e hënë, 29 shtator 2008

Few tips for 'Plugging holes in your app'

These are few mistakes we've come across while working on performance enhancement for an app.

If you are kind of guy who stores GUID in char(36) (weird), use Unique Identifier please, GUID requires 36 bytes of data but if you use UniqueIdentifier type, then we require only 16 bytes of data.

Also, also the N '' prefix, while encoding your Unicode data (to aviod SQL injection etc), if the fields are char or varchar type (check link for the comparison sheet) it will prove costly too.

And its easy to replicate this black hole which leaks your app,

With a test table containing 100,000 rows with a char(36) field containing guids,
The following SQL took 56 ms to run:
SELECT * FROM testtable WHERE guid = N'00008999-A3B3-41FE-BF23-40465CF14147'

Where as the following sql:
SELECT * FROM testtable WHERE guid = '00008999-A3B3-41FE-BF23-40465CF14147'
took 0 ms (less than 1).

Nuk ka komente: