���Forgive me for belaboring the point, but have you asked the SQL groups if 
there's a way to optimize (a) your queries and (b) your tables?

From: Mat�as Ni�o ListMail [EMAIL PROTECTED]

Well, I was just wondering if anyone had any off hand knowledge about which one 
is generally known to be faster. Trace timing sounds like a good idea, I'm just 
too short on time to set up an objective experiment, but I'll definitely get 
around to it eventually. 

The main reason I've gotten involved in walking tables is because I found 
(through timing tests) that running expensive queries (usually when trying to 
get DISTINCT values that crossreference multiple tables) takes up significantly 
more time than just pulling the tables down and running loops to get the right 
values. Now, don't get me wrong, I often don't have to walk tables and I try to 
avoid it at all cost, but some of these statistical pages require a TON of 
cross referencing of different data and I sometimes find that one walk through 
a table is actually faster than shooting multiple sql queries (or one big 
expensive query) at the DB. Other times, multiple queries are end up being 
faster. 

If you're dying for an example, I can write out out for you. It's s puzzle for 
sure! 

From: [email protected] 
I didn't mean the response.write statements (I figured those
were arbitrary); the whole looping thing still puzzles me.

What kind of formatting do you have to do that won't work in
your query? Maybe we can give you a better answer.

Oh, and as you've no doubt reasoned, I don't have a clue which
of these is faster. Have you tried timing them with a Trace.Write
before and after each loop?

Peter

-----Original Message-----
From: [email protected] On Behalf Of MAN95002

I should've disclaimed that the response.writes are only for the sake of
the example. 

I run a statistical analysis site and in order to produce meaningful
tables, I have to format a lot of data beyond the extent to which a mere
SQL statement can provide. On top of that, my database server is slow
and overburdened as it is, so I'm not very hard pressed to get into
hardcore procedural SQL programming. 

Hence, I find that I have no choice but to walk tables sometimes and
since there are so many ways to do it, I was curious myself as to which
was technically the fastest/most flexible. 

M.

--- In [email protected], "Peter Brunone"
wrote:
> 
> I'm curious as to why this matters. With a DataTable, chances
are 
> that there's a better way to get what you need than by looping through

> the whole table.
> 
> -----Original Message-----
> From: [email protected] On Behalf Of Mat�as Ni�o 
> ListMail
> 
> Which is FASTEST given 'dt' as a datatable to walk
> 
> dim i as int16
> for i = 0 to dt.rows.count -1
> response.write(dt.rows(i)("column1"))
> response.write(dt.rows(i)("column2"))
> response.write(dt.rows(i)("column3"))
> next
> 
> -OR-
> 
> dim dr as datarow
> for each dr in dt
> response.write(dr("column1"))
> response.write(dr("column2"))
> response.write(dr("column3"))
> next
> 
> -OR-
> 
> Dim dv as dataview = dt.defaultview
> for i = 0 to dv.count
> response.write(dv(i)("column1"))
> response.write(dv(i)("column2"))
> response.write(dv(i)("column3"))
> next
> 
> Taking all possible things into account, which is always best to use?
> 
> Thanks in advance for anyone who cares to bite...
> 
> Mat�as
> Manassas, VA


[Non-text portions of this message have been removed]



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to