Hi,I have a long-standing doubt about the performance of the count statement. I was told by developers in PL/SQL that using count(1) to find the rowcount was much more high-performing than using count(*), as count(*) fetches all the rows into memory before getting the exact count. I want to know whether this holds true for T-SQL as well, or are the two just the same? Thanking in anticipation of reply :) .
This is actually a failing of PL/SQL. T-SQL recognises that you're talking about count(*) and will consider any row. The same occurs with WHERE EXISTS (SELECT *...
So, in T-SQL use count(*) and let the optimiser do its stuff. In PL/SQL, acknowledge that it's not as good (hehe), and use count(1).
Microsoft is conducting an online survey to understand your opinion of the Msdn Web site. If you choose to participate, the online survey will be presented to you when you leave the Msdn Web site.