Top "Query-optimization" questions

For questions about making database queries run faster.

How to measure "queries per second"?

In literature SQL query efficiency is often measured in "queries pre second" (QPS). How those measures are made, considering that …

mysql query-optimization
MySQL explain Query understanding

I've read on some blogs and in some articles related to optimization, how to optimize queries. I read I need …

mysql query-optimization
Force MySQL to use two indexes on a Join

I am trying to force MySQL to use two indexes. I am joining a table and I want to utilize …

sql mysql query-optimization intersect
How to make JOIN query use index?

I have two tables: CREATE TABLE `articles` ( `id` int(11) NOT NULL AUTO_INCREMENT, `title` varchar(1000) DEFAULT NULL, `last_updated` datetime …

mysql sql join query-optimization
Subqueries with EXISTS vs IN - MySQL

Below two queries are subqueries. Both are the same and both works fine for me. But the problem is Method 1 …

mysql sql phpmyadmin query-optimization subquery
Postgres query optimization (forcing an index scan)

Below is my query. I am trying to get it to use an index scan, but it will only seq …

postgresql indexing query-optimization postgresql-9.1 postgresql-performance
Speeding up inner joins between a large table and a small table

This may be a silly question, but it may shed some light on how joins work internally. Let's say I …

sql query-optimization
Performance difference: condition placed at INNER JOIN vs WHERE clause

Say I have a table order as id | clientid | type | amount | itemid | date ---|----------|------|--------|--------|----------- 23 | 258 | B | 150 | 14 | 2012…

sql performance postgresql query-optimization
SQL: Inner joining two massive tables

I have two massive tables with about 100 million records each and I'm afraid I needed to perform an Inner Join …

sql sql-server sql-server-2008 query-optimization inner-join
MySql.Data.MySqlClient.MySqlException: Timeout expired

In recent times, a particular page in my web app throws the Exception Details: MySql.Data.MySqlClient.MySqlException: Timeout expired. …

c# mysql query-optimization ibatis timeoutexception