Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Use this tag for questions about improving the performance and/or efficiency of database queries.

Questions regarding query performance should use this tag. Be sure to include tags for the database type (, , etc) and database version tags such as . If you are joining tables, you can include tags such as or if you know what type of join you are using, include that, such as , , or ,

Your question should include a minimal query that exhibits the issue, a description of the tables and their columns (including data types), an execution plan (if possible one that shows actual row counts, times, etc.) and what troubleshooting you have attempted such as hints and rewriting the query.

IF joining tables, list the approximate number of rows of each table and the cardinality of the join columns, such as "there are approximately 200 order_id values for a particular customer_id.

history | excerpt history