is good have single index an composite index on same field
Posted by:
Reza ress
Date: September 16, 2014 09:13PM
CREATE TABLE test (
id INT NOT NULL,
last_name CHAR(30) NOT NULL,
first_name CHAR(30) NOT NULL,
PRIMARY KEY (id),
KEY `first_name` (first_name),
KEY `last_name` (last_name),
KEY `last_first` (last_name,first_name)
);
Is it good if i have table index in like that if i have queries like :
SELECT * FROM test WHERE first_name = 'A';
SELECT * FROM test WHERE last_name= 'A';
SELECT * FROM test WHERE first_name like '%A%';
SELECT * FROM test WHERE last_name like '%A%';
SELECT * FROM test WHERE last_name= 'A' AND first_name = 'A';
SELECT * FROM test WHERE last_name like '%A%' AND first_name like '%A%';
SELECT * FROM test WHERE last_name= 'A' OR first_name = 'A';
SELECT * FROM test WHERE last_name like '%A%' first_name OR like '%A%';
Subject
Views
Written By
Posted
is good have single index an composite index on same field
2302
September 16, 2014 09:13PM
1011
September 17, 2014 07:48PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.