It all depends on your hardware, but most likely your network is a bottleneck.
Aside from the fact that your query just reads the columns that you are actually using, making the selection is as fast as it will be. Caching is involved here when you execute it twice in a row, the second time it is much faster because the data is cached in memory. run dbcc dropcleanbuffers to check the effect of caching.
If you want to do this as quickly as possible, try implementing code that performs processing in T-SQL, so it can directly work with data directly on the server.
Another good tip for speed tuning is a table that reads on one disk (see file groups) and a table written on another disk. Thus, one disc can read continuously, and the other can write continuously. If both operations occur on the same disk, the disk heads continue to move back and forth, which seriously reduces performance.
If the logic of your record cannot be used for T-SQL, you can also take a look at the SQL CLR.
One more tip: when you select * from the table, use datareader if possible. Thus, you do not materialize all this primarily in memory.
GJ
gjvdkamp
source share