0
Hello, I am in urgent need of deleting 700,000 records on a table with just over 2 million. However, testing on the office server is taking hours because I need to filter a field and I will need to do this kind of deletion on other clients as well, could help me?
Edit1:
@Andersoncarloswoss, I have 24 columns that are:
APT_ID int(11)
APT_IDPRODUCAO int(11)
APT_TIPO varchar(10)
APT_HRINICIAL varchar(5)
APT_HRFINAL varchar(5)
APT_IDCLIENTE int(11)
APT_IDPRODUTO int(11)
APT_PRODUTIVIDADE decimal(5,2)
APT_PRODUTIVIDADEFAIXA decimal(5,2)
APT_QUANTIDADE decimal(8,2)
APT_IDMOTIVO int(11)
APT_IDCOMPONENTE int(11)
APT_HRPRODUTIVA decimal(15,10)
APT_HRDISPONIVEL decimal(15,10)
APT_IDOPERACAO int(11)
APT_IDTAXA int(11)
APT_HORAS decimal(15,10)
APT_IDDETALHEPARADA int(11)
APT_HRINICIOAPT varchar(5)
APT_HRFIMAPT varchar(5)
APT_PRODUTIVIDADEZERO varchar(1)
APT_HRDISPONIVELFAIXA decimal(5,2)
APT_HRPRODUTIVAFAIXA decimal(15,10)
APT_IDLEITURAHISTORICO int(11)
The column I need to use is the
APT_IDCLIENTE
Edit2: I cannot create new table because I use the primary keys of the current table.
And what is the table structure? Which SQL do you want to optimize?
– Woss
Evaluate if it is not easier to copy the records you want to keep to an auxiliary copy of your table, give a DROP TABLE in its original table and rename the auxiliary copy to the correct name. It may be necessary to remove any constraints and recreate them in the new table.
– anonimo
I cannot do this option of Insert, because I use the primary keys of this table that I am needing to delete the records
– Gabriel Cardoso
@Gabrielcardoso Information should be in the question, not in the comments. There is the [Edit] button that allows you to do this.
– Woss
It is the first time I ask question here, so I do not know how to use correctly, thanks for the information kk
– Gabriel Cardoso
Sorry but I didn’t understand this your consideration about the existence of primary key prevent you from copying the records that will not be deleted to a new table.
– anonimo
So, I meant that I use the Ids of the referenced table (Pointing table) to write to other tables, so if I enter the data (which I want to keep) into another table, the keys will be redone
– Gabriel Cardoso
Unless I disable auto increment
– Gabriel Cardoso