Hey guys,
We are having some major performance issues with SELECT queries out one of our databases. Please see the simple procedure and associated code below.
In the code the ExecuteReader() method is executing in around 10 seconds on a query returning 30K records. Iterating the Reader takes 2 minutes (even when I am not pumping the data into any other object). 2 minutes for a 30k row data set is unacceptable for us as we are expecting datasets in the millions.
Is there anything here that stands out to any of you? Hoping that your experience with ODP.NET and PL/SQL might help out.
create or replace PROCEDURE TRACKING_FETCH (
p_tracking_id IN NUMBER,
p_parent_id IN NUMBER,
p_media_id IN NUMBER,
p_custodian_id IN NUMBER,
p_return_cursor OUT SYS_REFCURSOR)
AS
BEGIN
OPEN p_return_cursor FOR
SELECT
*
FROM
tracking
WHERE
(tracking_id = p_tracking_id OR p_tracking_id = 0)
AND (parent_id = p_parent_id OR p_parent_id = 0)
AND (media_id = p_media_id OR p_media_id = 0)
AND (custodian_id = p_custodian_id OR p_custodian_id = 0);
END TRACKING_FETCH;
--
using (DataFactory command
= new DataFactory(dbConnection,
DatabaseType.Oracle,
CommandType.StoredProcedure,
"TRACKING_FETCH"))
{
command.AddInParameter("p_tracking_id", DbType.Int32, trackingid);
command.AddInParameter("p_parent_id", DbType.Int32, parentid);
command.AddInParameter("p_media_id", DbType.Int32, mediaid);
command.AddInParameter("p_custodian_id", DbType.Int32, custodianid);
using (var dr = command.ExecuteReader())
{
while (dr.Read())
{
//Do Things...
}
}
}
Any guidance will be greatly appreciated.