• GilaMonster (10/25/2012)


    Probably waits, yes.

    3 reads doesn't look like there was much data...

    That query only returns 114 rows...

    Changed the query to return 286k rows and the IO is quite different (on the "detail" table), since CHAR always has 5 bytes....

    Table 'stable_c'. Scan count 1, logical reads 1037, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.

    Table 'ptable_cc'. Scan count 1, logical reads 16, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.

    Table 'stable_vc'. Scan count 1, logical reads 639, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.

    Table 'ptable_vc'. Scan count 1, logical reads 23, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.

    Same CPU time...

    I made the column 5 bytes long, but I inserted data from 1 to 5 bytes... that's why char has more reads than varchar...

    The execution plan states that the char has a cost of 47% and varchar of 53%... The merge join on char is 37% and on varchar is 44%.

    Thanks,

    Pedro



    If you need to work better, try working less...