select sum(row_size)
from (
select
char_length(column1)+
char_length(column2)+
char_length(column3)+
char_length(column4) ... <-- перечисляем здесь все колонки
as row_size
from your_table
) as tbl1;
select h.name AS host_name, i.name AS item_name, i.key_ as item_key, FROM_UNIXTIME(hs.clock) AS last_time, hs.value, hs.logeventid
from
hosts h
join items i on h.hostid = i.hostid
join history_log hs on i.itemid = hs.itemid
where hs.clock > UNIX_TIMESTAMP() - 86400 * 30 and i.hostid = '999' #and hs.logeventid = '4611'
order by last_time, item_name
Andrey San: select sum(row_size)
from (
select
char_length(host_name)+
char_length(item_name)+
....
as row_size from (
select h.name AS host_name, i.name AS item_name, i.key_ as item_key, FROM_UNIXTIME(hs.clock) AS last_time, hs.value, hs.logeventid
from
hosts h
join items i on h.hostid = i.hostid
join history_log hs on i.itemid = hs.itemid
where hs.clock > UNIX_TIMESTAMP() - 86400 * 30 and i.hostid = '999' #and hs.logeventid = '4611'
order by last_time, item_name)
)