Array
(
[0] => Array
(
[id] => 1
[select_type] => SIMPLE
[table] => referrals
[partitions] =>
[type] => ref
[possible_keys] => parent_index,user_id_index
[key] => parent_index
[key_len] => 4
[ref] => const
[rows] => 904
[filtered] => 100.00
[Extra] =>
)
[1] => Array
(
[id] => 1
[select_type] => SIMPLE
[table] => orders
[partitions] =>
[type] => ref
[possible_keys] => user_currency_date_index
[key] => user_currency_date_index
[key_len] => 15
[ref] => admin.referrals.user_id,const
[rows] => 611
[filtered] => 11.11
[Extra] => Using index condition
)
)
SELECT `price`,`currency`,`status` FROM `orders` JOIN `referrals` ON referrals.user_id = orders.user_id WHERE `currency` = 'EUR' AND `date_add` >= '2021-01-18 00:00:00' AND `date_add` <= '2021-01-24 23:59:59' AND referrals.parent_id = 4
Переносил referrals.parent_id и туда и туда, все равно долго выборку делает(
Индексы добавил.
Характеристики сервера:
Xeon E5-2620V3 2.4 ГГц (8 ядер)
Оперативная память: 12 ГБ
Жесткие диск: 144 ГБ
Порт: 100 Мбит/с