2
我正在一個MySQL查詢工作,但慢得令人痛苦,甚至只〜11000行。優化「計數小於」查詢
describe select date(date_added) as curr_date,
(select count(*) from calendar_entries as ce where date(date_added)<=curr_date) as until_count
from
calendar_entries
group by date(date_added)
的目標是隨着時間的推移測量表的增長,所以每一天所在的表被改變,給我當時行的總數。這可能與某種總和,即(僞)
Total(n) = Total(n-1)+numberAdded(n)
做,但我不知道如何去在SQL
一個