It has to do with how the data in each row is addressed. If you use an
ordinal, the addressing is simple to resolve. If not the class has to search
the list of columns (each time) and determine if the string provided is a
match. It can take 10 times longer to resolve using strings.
--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speakerwww.betav.com/blog/billvawww.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visitwww.hitchhikerguides.netto get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------
thanks for your answer. Im not interested in using DataTables, i just
want to copy the contents of the reader to the corresponding member
fields of the objects. Using the OracleDataReader's int-indexer
instead of the string-indexer doesnt't seem to affect performance at
all.
Im just wondering why the access of the OracleDateReader's indexer is
so slow. The actual transfer of the data (from the db to the client)
is performed within the Read()-method, isn't it? What is happening
within those indexers that is so time-consuming?
Best regards
Henning
If the purpose of the code is to build a DataTable, then use
DataTable.Load
method.
Yes, referencing the columns by ordinal is far faster than using strings.
You might also investigate other data providers. Data Direct has a
well-respected provider that's supposed to be faster.
--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speakerwww.betav.com/blog/billvawww.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no
rights.
__________________________________
Visitwww.hitchhikerguides.nettoget more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------
Hello NG,
I'm using the Oracle Data Access Components and I've encountered
serious performance problems with the OracleDataReader. The following
function fills the memberfields of an object with the content of a
reader:
internal void FillFromReader(IDataReader Reader)
{
m_id = (int)Reader["id"];
m_name = (string)Reader["name"];
// ... ~ 20 more lines of this...
}
Note that the call to Reader.Read() is made outside the function. With
the OracleDataReader this function needs an average of 2000 ticks to
complete. With the SQLDataReader, it needs only about 150 ticks.
What am I doing wrong? Is this a problem with the configuration of the
client or the dbms? Or is there a better way to implement
FillFromReader()?
Cheers
Henning