Top "Query-optimization" questions

For questions about making database queries run faster.

MySQL indexes - what are the best practices?

I've been using indexes on my MySQL databases for a while now but never properly learnt about them. Generally I …

mysql indexing query-optimization
PostgreSQL LIKE query performance variations

I have been seeing quite a large variation in response times regarding LIKE queries to a particular table in my …

postgresql indexing pattern-matching query-optimization sql-like
How to find out why the status of a spid is suspended? What resources the spid is waiting for?

I run EXEC sp_who2 78 and I get the following results: How can I find why its status is suspended? …

sql sql-server optimization query-optimization sql-tuning
Checking multiple columns for one value

I have a table that has columns like this for example: id,col1,col2,col3,col4 Now, I want to …

mysql sql select query-optimization
How do I use DB2 Explain?

How do I use DB2's Explain function? -- both to run it, and to use it to optimize queries. …

sql db2 query-optimization explain
Subquery v/s inner join in sql server

I have following queries First one using inner join SELECT item_ID,item_Code,item_Name FROM [Pharmacy].[tblitemHdr] I …

sql performance query-optimization sql-server-2012
Left join or select from multiple table using comma (,)

I'm curious as to why we need to use LEFT JOIN since we can use commas to select multiple tables. …

sql mysql query-optimization left-join
Mysql count performance on very big tables

I have a table with more than 100 millions rows in Innodb. I have to know if there is more than 5000 …

mysql sql count query-optimization database-performance
Optimizing Oracle CONNECT BY when used with WHERE clause

Oracle START WITH ... CONNECT BY clause is applied before applying WHERE condition in the same query. Thus, WHERE constraints won't …

sql performance oracle select query-optimization
Oracle SQL query with CASE WHEN EXISTS subquery optimization

I'm using the following query to create a view in Oracle 11g (11.2.0.3.0). CREATE OR REPLACE FORCE VIEW V_DOCUMENTS_LIST ( …

oracle subquery query-optimization select-case