以下查询在 Sequel 中有效:
table_sizes = db_config["SELECT table_name,table_rows / 1000000 as table_rows, data_length / 1000000 as data_length, index_length / 1000000 as index_length,round(((data_length + index_length) / 1024 / 1024 / 1024),5) 'size'
FROM information_schema.TABLES
WHERE table_schema = '#{db_name}' and table_name in ('table1','table2','table3'....'table20')"]
但是,当我做这样的事情时,这两个查询都不起作用:
arr = ['table1','table2','table3'...'table20']
table_sizes = db_config["SELECT table_name,table_rows / 1000000 as table_rows, data_length / 1000000 as data_length, index_length / 1000000 as index_length,round(((data_length + index_length) / 1024 / 1024 / 1024),5) 'size'
FROM information_schema.TABLES
WHERE table_schema = '#{db_name}'"].filter(:table_name => arr)
或者:
table_sizes = db_config["SELECT table_name,table_rows / 1000000 as table_rows, data_length / 1000000 as data_length, index_length / 1000000 as index_length,round(((data_length + index_length) / 1024 / 1024 / 1024),5) 'size'
FROM information_schema.TABLES
WHERE table_schema = '#{db_name}'"].where(:table_name => arr)
我应该怎么做?Sequel 不支持结果后过滤吗?