Select * FROM tblCustomers

Roey

Well-known member
Joined
Oct 10, 2002
Messages
238
Location
Canada
I realize that using the SQL statement Select * is slower than naming all of the fields in a table, but at what stage does it begin to effect clients.

Also using the CommandBuilder in ADO.net is supposed to be slower, but again how much.

And if you know the answers to these questions could you please tell me of a suitable method for testing these methods

Thanks
 
Select a 10 000 records with each method and time the procedure with a timer...
 
Makes sense, but how would you start and stop the timer. Have you any examples, as this would obviously be a very handy test for all areas of prpgramming.
 
Yes, I got an example of this somewhere...Ill get you the code..
If I put my hand on it...Which i dont..
Just put a timer on before the proc(s) you want to test and check timeElapsed at exit...shouldnt be a big deal.

(Just select a lot of records to have significant times)
 
Last edited by a moderator:
Using "SELECT *" isnt any slower than listing out each individual field (as far as I know). But Selecting all fields when you only need half of them WILL be slower. But how slow is too slow? I dont usually use timers to test speed of code until farther into a project. In general, you can guestimate how much is "too much". For some applications, returning 1000 rows is no big deal. For others, that may be WAY too much (over a modem, for instance).

If you want some really simple timing code, try something like the following:
C#:
int lastTime = Environment.TickCount;
// do something here...
int totalTime = Environment.TickCount - lastTime;
System.Diagnostics.Debug.WriteLine(String.Format("That took {0} milliseconds", totalTime));
Code:
Dim lastTime As Integer = Environment.TickCount
 do something here...
Dim totalTime As Integer = Environment.TickCount - lastTime
System.Diagnostics.Debug.WriteLine(String.Format("That took {0} milliseconds", totalTime))

(Not sure if the VB code is right... ah well)

-Nerseus
 
Back
Top