Changing the primary key from non-clustered to clustered on tables causing drop in Join performance

wanderer 2018-05-25 04:38:16

Tables in a database were heaps and had non-clustered primary keys. I changed the primary keys to clustered and saw a drop in performance.

This query is joining tables on clustered index keys and taking 10 secs and doing a lot more 'worktable' logical reads than a exactly same query joining the tables with nonclustered primary keys on the same columns which took 5 seconds and a lot less 'worktable' logical reads. Joins are using primary-key/foreign-key columns. Please let me know what is going wrong here that is causing performance to drop.

I will attach the Non-clustered primary keys query in a second post(NonClusteredPrimarykeys.pesession)

Hugo Kornelis 2018-05-26 09:01:21
The same question was reposted a few hours later, apparently because there were issuse with the account creation process. I will answer the more recent copy of the question.

Perhaps an admin that remove this question?