パフォーマンスは、7日間隔で記録するレコードの数によって異なります。
select date,
sum(cnt)
from (SELECT
count(id) as cnt,
date(created_date) as date
FROM records
WHERE created_date > DATE_SUB(NOW(), INTERVAL 7 day)
and method ='tw'
and created_date < now()
group by date
union all (select 0 as cnt, date(DATE_SUB(NOW(), INTERVAL 6 day)) as date)
union all (select 0 as cnt, date(DATE_SUB(NOW(), INTERVAL 5 day)) as date)
union all (select 0 as cnt, date(DATE_SUB(NOW(), INTERVAL 4 day)) as date)
union all (select 0 as cnt, date(DATE_SUB(NOW(), INTERVAL 3 day)) as date)
union all (select 0 as cnt, date(DATE_SUB(NOW(), INTERVAL 2 day)) as date)
union all (select 0 as cnt, date(DATE_SUB(NOW(), INTERVAL 1 day)) as date)
union all (select 0 as cnt, date(NOW()) as date)
) t
group by date