Database execution time

Answered

When a query gets executed you get some metrics at the end in the database console pane, for example:

 

1 row retrieved starting from 1 in 8 s 386 ms (execution: 8 s 374 ms, fetching: 12 ms)

 

Is the execution the time the database took to execute? What does fetching mean?

 

0
5 comments

Execution time: yes - it is the time taken to execute the statement by the database. Fetching time - the time which took retrieving the data (result set) from the database.

0

In one example, I see:
[2024-01-23 16:01:04] 0 rows retrieved in 2 h 2 m 47 s 874 ms (execution: 309 ms, fetching: 2 h 2 m 47 s 565 ms)

How can it take over 2 hours to retreive 0 rows?

0
To analyze the performance issue, we need more context about your query, how often it occurs, and the problem scope (whether it's happening for every table you query). I'd suggest uploading the idea (Help - Show Log in Files) and database log (Help - Show SQL Log in Files) onto our FTP https://uploads.jetbrains.com/. Provide the upload id in your reply so we can investigate this.
0

I'm quite certain the query is slow because of a missing index. But I would have expected to see a long ‘execution’ time in this case. 

My understanding is that the ‘fetch’ time is how long it takes to retrieve the data…which in my case is 0 rows, so I'd expect the fetch time to essentially be 0ms.

So, I'm not really asking for help investigating the performance, but rather a clearer explaination of what ‘execution’ time and ‘fetch’ time actually refer to. 

thanks

0
Sure. The fetch time can be described as the duration of transferring the result set in chunks. So it's pretty much the total time minus the query execution. 

In your case, if the table didn't have an index, it would actually increase the query execution time as it would force a full table scan or other inefficient plans. Therefore, it shouldn't impact the fetch time, especially if there are no records in the table.

That said, I'd suggest specifying your database and table definition (we're particularly interested if columns are of CLOB or BLOB types). As a workaround, you could try to uncheck "Limit page size to" option in File | Settings | Database | Data Editor and Viewer and see if it improves the situation.
0

Please sign in to leave a comment.