When connecting to a SQL Server Database in C# I get the query execution time like so:
SqlConnection conn = new SqlConnection(new SqlConnectionStringBuilder()
{
DataSource = "SERVER",
InitialCatalog = "DB",
UserID = "USER",
Password = "PASSWORD"
}.ConnectionString);
conn.StatisticsEnabled = true;
SqlCommand sqlCommand = new SqlCommand("SELECT * FROM TABLE", conn);
try
{
conn.Open();
sqlCommand.CommandType = CommandType.Text;
// execute the command
SqlDataReader sqlDataReader = sqlCommand.ExecuteReader();
var stats = conn.RetrieveStatistics();
var milliSecs = (long)stats["ExecutionTime"];
}
catch(Execption e){
}
But I cannot find a similar method to achieve this with a Oracle database.
I have looked at this question but this does the timing on the database not in C#. (I don't have access to edit the queries I will be monitoring).
How can I achieve this? Is there an equivalent function in Oracle.DataAccess library?