An online retailer gathers transactions in a large table where the 'category' field is used frequently for filtering. The current queries take considerable time to return results. Which technique is most likely to provide a performance boost when filtering by 'category'?
Sort the category column automatically when a query is run
Partition the table by transaction ID
Use a subquery filtering on the category column in each query
Add an index on the category column to limit the full table scans
Placing an index on a frequently filtered column accelerates lookups and reduces the amount of data scanned. Subqueries do not necessarily speed up queries if they still require full scans. Sorting by default does not reduce search time unless data is already indexed in a helpful way. Partitioning by transaction ID focuses on a different column, which would not improve filtering by category.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is an index in a database?
Open an interactive chat with Bash
How does adding an index improve query performance?
Open an interactive chat with Bash
Are there any downsides to adding a database index?