Re: Is getting a column by name slower then ordinal? by Smokey
Smokey
Sat Mar 01 14:37:47 CST 2008
20,000 is just an example number for benchmarking... why I am not using a
datatable.load because I need to process records as they come in for speed..
when we did the same problem with data tables our performance was reduced by
a significant amount (over 10% more time) and memory usage was an issue...
when we do data readers at least we can get rid of the data as its taken
care of what we have to on a row by row basis...
"William Vaughn" <billvaNoSPAM@betav.com> wrote in message
news:328B9B58-34FD-42E7-8567-858A1D1DFC15@microsoft.com...
> Yea, a LOT slower (by name). Ah, my questions are:
>
> 1) Why aren't you using the new DataTable.Load method?
> 2) Why are you bringing 20,000 rows to the client? Can't you do the work
> on the server?
>
> --
> __________________________________________________________________________
> William R. Vaughn
> President and Founder Beta V Corporation
> Author, Mentor, Dad, Grandpa
> Microsoft MVP
> (425) 556-9205 (Pacific time)
> Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
> ____________________________________________________________________________________________
> "Smokey Grindel" <nospam@nospam.com> wrote in message
> news:O9tlkwxeIHA.5160@TK2MSFTNGP05.phx.gbl...
>> If I am doing a very large loop in a data reader say 20,000 rows being
>> read in... now I need to read data so I am doing the
>> reader.Get[Type](reader.GetOrdinal("[columnname]"))... which seems like
>> it'd be slow doing that x number of times per row... is it better to use
>> the ordinal by itself? does looking up an ordinal have any major
>> performance impact? should I look them up once and cache them in
>> variables? what do you guys thinks? thanks!
>>
>