From: Reindl Harald Date: November 4 2011 9:10am Subject: Re: Deleting Records in Big tables List-Archive: http://lists.mysql.com/mysql/226236 Message-Id: <4EB3AC06.4020104@thelounge.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig47A94135E797EAC6685AC51E" --------------enig47A94135E797EAC6685AC51E Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Am 04.11.2011 08:22, schrieb Adarsh Sharma: > delete from metadata where id>2474; > but it takes hours to complete. >=20 > CREATE TABLE `metadata` ( > `meta_id` bigint(20) NOT NULL AUTO_INCREMENT, > `id` bigint(20) DEFAULT NULL, > `url` varchar(800) DEFAULT NULL, > `meta_field` varchar(200) DEFAULT NULL, > `meta_value` varchar(2000) DEFAULT NULL, > `dt_stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, > PRIMARY KEY (`meta_id`) > ) ENGINE=3DInnoDB AUTO_INCREMENT=3D388780373 ; >=20 > Please let me know any quickest way to do this. > I tried to create indexes in these tables on id, but this too takes tim= e well i guess you have to sit out add the key wrong table design having an id-column without a key or something weird in the application not using the primary key for such operations --------------enig47A94135E797EAC6685AC51E Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk6zrAYACgkQhmBjz394Anm7jQCgkeMmXarDZwwL8B3U6SpTTQsv HXYAnRrsj3sCGvbGdVtvBh+qlckGD8oP =zWfj -----END PGP SIGNATURE----- --------------enig47A94135E797EAC6685AC51E--