NHProf is not detecting update batches (set through adonet.batch_size) when run against Oracle. Oracle does support update batches if using
ODP.NET and OracleDataClient. (It does not work with Microsoft's System.Data.OracleClient.) The results in NHProf look something like this:
INSERT INTO <TABLE> ... (no duration)
INSERT INTO <TABLE> ... 1 ms <-- Parameters are identical
For collections:
INSERT INTO <COLLECTION_TABLE> ... (no duration - item#0)
INSERT INTO <COLLECTION_TABLE> ... (no duration - item#1)
INSERT INTO <COLLECTION_TABLE> ... (no duration - item#2)
INSERT INTO <COLLECTION_TABLE> ... (no duration - item#3) <-- These don't look batched.
INSERT INTO <COLLECTION_TABLE> ... (no duration - item#3) <-- Last item is always duplicated twice.
Here's the reason... The OracleDataClientBatchingBatcher puts out log messages in a slightly different (and erroneous) format
than the SqlClientBatchingBatcher, which results in NHProf not detecting
that batches are being executed. In the
OracleDataClientBatchingBatcher, when an OracleCommand is created and
batched, it writes out the SQL text and parameters. To NHProf, this
looks like a command execution. In reality, it is appended to the
current batch. When the batch is actually executed, the
OracleDataClientBatchingBatcher writes out the last command and
parameters rather than the full batch, which makes it look like the
statement is being re-executed. In reality, the entire batch is being
executed against the database. Needless to say, this is rather
confusing.
This should be fixed in NHibernate, but that doesn't help everyone running with current versions of NHibernate. Just wondering if you can do anything on the parsing end to display better information in the profiler.
BTW - I've added this as issue 2047 in NHibernate's JIRA.
http://nhjira.koah.net/browse/NH-2047James
--
James Kovacs, B.Sc., M.Sc., MCSD, MCT
Microsoft MVP
http://www.jameskovacs.comjko...@post.harvard.edu403-397-3177 (mobile)