mysql创建LDL_mysql – 允许JawsDB中的用户创建INSERT语句

回答之前的披露:我和JawsDB 🙂

Jaws根据information_schema通过将该数据库中每个表的data_length和index_length值相加来计算已用空间.

像下面这样的查询用于执行此操作.

select

s.schema_name

,sp.grantee user

,cast(round(sum(coalesce(t.data_length + t.index_length, 0)) / 1024 / 1024, 3) as char) db_size_mb

,sp.has_insert

from

information_schema.schemata s

inner join

information_schema.tables t on s.schema_name = t.table_schema

inner join (

select

spi.grantee

,spi.table_schema

,max(

case

when spi.privilege_type = 'INSERT' then 1

else 0

end

) has_insert

from

information_schema.schema_privileges spi

group by

spi.grantee

,spi.table_schema

) sp on s.schema_name = sp.table_schema

group by

s.schema_name;

如果数据库表的大小超过授予用户计划的大小,则会暂时撤消INSERT权限,直到数据库大小恢复为符合计划.这可以通过删除旧数据或升级其计划来完成.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值