我有一個sql查詢來從4個表中獲取值。在我的查詢需要很多時間。我需要簡化查詢 我需要的是我必須只顯示50條記錄。在我的桌子上,我有90,000條記錄。所以我deciede申請批處理像 首先從第一個表中選擇50個記錄,然後檢查與其他3個表。 如果50是滿意,我將顯示,否則我還得繼續下一個50查詢性能
但是我沒有想法實現
select file_name,
A.id,
A.reference,
user.username,
c.update_date
from A_Table A,
(select reference
from B_Table
where code = 'xxx'
group by reference
having count(*) > 1) B,
C_Table c,
D_Table d
where A.reference = B.reference
and A.id = c.id
and A.code = 'ICG'
and c.updated_by = d.user_id
order by 3
limit 20;
告訴我們解釋計劃,並在桌子上 –
是01和02拼錯,應respecively解讀爲A,B的指標? – alko
一個atble它有90,000條記錄。所以需要很長時間才能從表A的前50行中選擇並與其他 – jackyesind