Roey Posted July 21, 2003 Posted July 21, 2003 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 Quote
Ariez Posted July 22, 2003 Posted July 22, 2003 Select a 10 000 records with each method and time the procedure with a timer... Quote Auto-suggestion: "I have a life" Uncontroled thinking: "So what the.."
Roey Posted July 22, 2003 Author Posted July 22, 2003 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. Quote
Ariez Posted July 22, 2003 Posted July 22, 2003 (edited) Yes, I got an example of this somewhere...I'll 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) Edited July 22, 2003 by Ariez Quote Auto-suggestion: "I have a life" Uncontroled thinking: "So what the.."
*Experts* Nerseus Posted July 22, 2003 *Experts* Posted July 22, 2003 Using "SELECT *" isn't 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 don't 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: int lastTime = Environment.TickCount; // do something here... int totalTime = Environment.TickCount - lastTime; System.Diagnostics.Debug.WriteLine(String.Format("That took {0} milliseconds", totalTime)); 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 Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Ariez Posted July 22, 2003 Posted July 22, 2003 Some people write when they sleep...:-\ Quote Auto-suggestion: "I have a life" Uncontroled thinking: "So what the.."
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.