SPLK-1004 practice question 10 of 10

Which is generally the most efficient way to run a transaction?

Full set: 117 questions

Domain Splunk Cloud Platform and Data Security

Answer options
A: Run the search query in Smart Mode.
B: Using | sort before the transaction command.
C: Run the search query in Fast Mode.
D: Rewrite the query using stats instead of transaction. Correct answer
Correct Answer:
D. Rewrite the query using stats instead of transaction.
Explanation

The transaction command is one of the most resource-intensive commands in Splunk because it is stateful, requiring significant memory and CPU to process. It must compare events and hold them in memory to group them into transactions. In contrast, the stats command is a streaming command that is far more efficient for grouping events based on one or more fields. For many use cases, a search using stats with functions like values(), earliest(), and latest() can achieve the same result as a transaction search but with substantially better performance. Therefore, rewriting the query to use stats is generally the most efficient approach.

Why Incorrect

A. Smart Mode automatically switches to the resource-heavy Verbose Mode when it encounters transforming commands like transaction, so it does not improve efficiency.
B. While sorting is often necessary for transaction, adding an explicit | sort command before it introduces another layer of processing, which typically decreases overall efficiency.
C. The transaction command requires full event data and cannot run in Fast Mode, which disables the necessary field and event discovery for performance gains.

References

1. Splunk Enterprise Documentation, Search Manual, "transaction command":

Usage Section: "The transaction command can be resource-intensive. In many cases, you can use the stats command to get the same or similar results more efficiently. [...] Before you use the transaction command, read the topic 'Stats versus transaction' in this manual." This directly supports that stats is more efficient.

2. Splunk Enterprise Documentation, Search Manual, "Stats versus transaction":

Performance considerations: "The transaction command is more expensive than the stats command. The transaction command must hold the raw events in memory while it determines which events are part of a transaction. The stats command needs only the field values that it is operating on." This explains why stats is more efficient.

3. Splunk Enterprise Documentation, Search Manual, "Search modes":

Smart mode: "Switches between Fast and Verbose modes based on the type of search you are running. [...] For searches that include transforming commands such as stats, chart, timechart, and top, the search mode switches to Verbose." This confirms that using transaction forces a switch to the less efficient Verbose mode.

Fast mode: "Field discovery is disabled. [...] This mode does not generate the data necessary for post-process searches, such as event sampling." This explains why transaction is incompatible with Fast Mode.

Scroll to Top