Why isn't INT more efficient than UNIQUEIDENTIFIER (according to the execution plan)?
        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
            10:21 UTC
        
        
        Read the original article
        Hit count: 137
        
sql-server
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?
EDIT:
The question is not about which is more efficient, but why is the query execution plan showing both queries as having the same cost?
© Stack Overflow or respective owner