Splunk Enterprise

SQL Query Execution Time

vijayansundarar
New Member

I am hoping to use DB Connect to perform an SQL query and log the execution time? (As i can do in an sql client with set timing on).

If this is a possible use case for Splunnk DB Connect, is there some document on how to achieve this?

Tags (1)
0 Karma

ziegfried
Influencer

DB Connect logs the execution time of the commands by default. You can use the following search for example to see the execution times of dbquery:

index=_internal sourcetype=dbx_debug (logger=DatabaseQueryCommand (action=executing OR "statement executed")) OR (logger=ExecutionContext "Execution finished") 
| eval query_duration=tostring(duration/1000,"duration")
| transaction thread maxpause=30m startswith=(logger=DatabaseQueryCommand action=executing) endswith=(logger=ExecutionContext)
| table _time query database count query_duration
0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

What Is the Name of the USB Key Inserted by Bob Smith? (BOTS Hint, Not the Answer)

Hello Splunkers,   So you searched, “what is the name of the usb key inserted by bob smith?”  Not gonna lie… ...

Automating Threat Operations and Threat Hunting with Recorded Future

    Automating Threat Operations and Threat Hunting with Recorded Future June 29, 2026 | Register   Is your ...

Keep the Learning Going with the New Best of .conf Hub

Hello Splunkers, With .conf26 getting closer, there’s already a lot of excitement building around this year’s ...