mysql> select count from data_property; ----------- | count | ----------- | 120153957 | ----------- 1 row in set (0.00 sec) mysql> select count from data_variable; --------- | count | ---------- | 3721836 | ---------- 1 row in set (0.00 sec)
mysql> select count from data_variable where id in (select distinct variableid from data_property where name='vstatus' and value='inactive'); ---------- count ---------- 0 ---------- 1 row in set (0.00 sec) mysql> select count from data_property where name='vstatus'; ---------- count ---------- 0 ---------- 1 row in set (0.00 sec) mysql> select value,count count from data_property where name='device' group by value order by count desc; Empty set (0.00 sec) mysql> select name from data_property; Empty set (0.00 sec) mysql> select variableid from data_property; Empty set (0.00 sec)
mysql> select distinct vstatus from data_property_flat limit 10; ---------- vstatus ---------- NULL active inactive ----------
select id form data_variable where id in (select id from data_property_flat where vstatus - 'inactive' ) limit 5;
select * from data_variable where id =xxxxx; ( where xxxxx was a valid id that we found in the previous query's output)
create table data_variable_BACKUP like data_variable; insert into data_variable_BACKUP select * from data_variable;
create table data_property_BACKUP like data_property; insert into data_property_BACKUP select * from data_property;
select count(1) from data_variable_BACKUP; select count(1) from data_variable;
select count(1) from data_property_BACKUP; select count(1) from data_property;
delete from data_variable where id in (select id from data_property_flat where vstatus='inactive');
delete from data_property where variableid in (select id from data_property_flat where vstatus='inactive'); error: incorrect key file for table "./be13/data_property.MYI"; try to repair it
repair table data_property; check table data_property; delete from data_property where variableid in (select id from data_property_flat where vstatus='inactive');
drop table data_property_BACKUP drop table data_variable_BACKUP