Isn't INT more efficient than UNIQUEIDENTIFIER?

Posted by ck on Stack Overflow See other posts from Stack Overflow or by ck
Published on 2010-03-19T09:41:25Z Indexed on 2010/03/19 9:51 UTC
Read the original article Hit count: 384

Filed under:

I have a parent table and child table where the columns that join them together are the UNIQUEIDENTIFIER type.

The child table has a clustered index on the column that joins it to the parent table (its PK, which is also clustered).

I have created a copy of both of these tables but changed the relationship columns to be INTs instead, have rebuilt the indexes so that they are essentially the same structure and can be queried in the same way.

When I query for a known 20 records from the parent table, pulling in all the related records from the child tables, I get identical query costs across both, i.e. 50/50 cost for the batches.

If this is true, then my giant project to change all of the tables like this appears to be pointless, other than speeding up inserts. Can anyone provide any light on the situation?

© Stack Overflow or respective owner

Related posts about sql-server