我必须在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