insert into metadata_statistics (order_sequence, metadata_defn, total_entries, rundate, metadata_id)
select rownumber() over(order by data_size desc), 
'DataSizePerItem', data_size, current timestamp, id
from (
select itd_item_id id,
coalesce(length(itd_blob),length(itd_bit_varchar),0) as data_size
from itd
where  itd_company_id = 40001
and itd_next_version_id = 999999999
)as temp
;
commit;
