|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
インデックスカバーリングの検証 |
|
|
|
|
http://www7b.software.ibm.com/dmdd/library/techarticle/0303kuznetsov/0303kuznetsov.html |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LIKE句 |
|
LIKE句 |
|
LIKE句 |
|
SELECT
LAST_NAME, FIRST_NAME FROM CUSTOMER_DATA WHERE LAST_NAME LIKE '%STONE' |
|
|
インデックスなし |
|
LAST_NAMEだけインデックス |
|
(LAST_NAME,FIRSTNAME)のインデックス |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ORDER By句 |
|
ORDER By句 |
|
ORDER By句 |
|
|
SELECT LAST_NAME,
FIRST_NAME, PHONE_AREA, PHONE_NUMBER FROM CUSTOMER_DATA ORDER BY LAST_NAME,
FIRST_NAME |
|
|
(LAST_NAME, FIRST_NAME, PHONE_AREA,
PHONE_NUMBER)のインデックス |
|
インデックスなし |
|
(LAST_NAME,FIRSTNAME)のインデックス |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JOIN句 |
|
JOIN句 |
|
|
SELECT
CUSTOMER_DATA.FIRST_NAME, CUSTOMER_DATA.LAST_NAME, CUSTOMER_DATA.PHONE_AREA,
CUSTOMER_DATA.PHONE_NUMBER, |
|
|
CUSTOMER_ORDER.ORDER_NUMBER,
CUSTOMER_ORDER.ORDER_DT, CUSTOMER_ORDER.AMOUNT |
|
|
FROM CUSTOMER_DATA JOIN
CUSTOMER_ORDER ON ID = CUSTOMER_ID |
|
|
|
|
CUSTOMER_DATA表の(ID, FIRST_NAME, LAST_NAME,
PHONE_AREA, PHONE_NUMBER)にインデックス |
|
|
CUSTOMER_ORDER表の(CUSTOMER_ID, ORDER_NUMBER,
ORDER_DT, AMOUNT)にインデックス |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
インデックスカバリング(Index Covering) |
|
|
|
SELECTでインデックスが使われるようにすること。 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|