我必須在mysql中使用和不使用索引運行相同的查詢。 我創建索引這樣的:在mysql中執行帶索引和不帶索引的查詢
create index index_1 on table_1(column_name);
create index index_2 on table_2(column_name);
我執行這一點,我得到的結果0行已受到影響,這兩個時間。這個可以嗎?
因爲當我執行我有(後我創建的索引)的查詢,它需要我的同時,之前
我有多個有關此數據庫的小查詢,如
SELECT DISTINCT customers.customer_id, customers.customer_name
FROM customers
INNER JOIN accounts ON customers.customer_id = accounts.customer_id
INNER JOIN transactions ON transactions.account_id = accounts.account_id
WHERE transactions.trn_date >= '2011/05/01'
AND transactions.trn_date <= '2011/05/31'
ORDER BY customers.customer_id
太少的信息。我們需要表定義,查詢等。 – jarlh
而索引是? – jarlh
我們必須自行決定在基表上創建2個索引以減少查詢的執行時間,並且仍然會有新數據加載時間的輕微增加 – Thodoris