Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

Posted
Select a 10 000 records with each method and time the procedure with a timer...

Auto-suggestion: "I have a life"

Uncontroled thinking: "So what the.."

Posted
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.
Posted (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 by Ariez

Auto-suggestion: "I have a life"

Uncontroled thinking: "So what the.."

  • *Experts*
Posted

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

"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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...