Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6563285
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:48:44+00:00 2026-05-25T13:48:44+00:00

MySQL/ASP – Delete Duplicate Rows I have a table with 100,000 rows called ‘photoSearch’.

  • 0

MySQL/ASP – Delete Duplicate Rows
I have a table with 100,000 rows called ‘photoSearch’. When transferring the data from other tables (that took bloody ages and I was bloody tired), I accidentally forgot to remove the test transfer I did, which left 3500 rows in the table before I transferred everything over in one go.

The ID column is ‘photoID’ (INT) and I need to remove all duplicates that have a photoID of less than 6849. If I could just remove the duplicates, it would be less painful than to delete the table and start another transfer.

Has anybody got any suggestions on the most practical and safest way to do this?


UPDATE:

I actually answered my own question. I backed up my table for safety, and then I ran this:

ALTER IGNORE TABLE photoSearch ADD UNIQUE INDEX unique_id_index (photoID);

This removed all 3500 duplicates in under a minute 🙂


  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T13:48:45+00:00Added an answer on May 25, 2026 at 1:48 pm

    Traditional method

    Backup your existing table photoSearch to something like tmp_photoSearch using a

    create table tmp_photoSearch select * from photoSearch;
    

    After that, you can perform data massage into table tmp_photoSearch.
    Once you have gotten the results as expected,
    perform a swap table

    rename table photoSearch to photoSearch_backup, tmp_photoSearch to photoSearch;
    

    To increase insert speed (if the bottle-neck is not on network transfer),

    http://dev.mysql.com/doc/refman/5.0/en/insert-speed.html

    To increase performance for MyISAM tables, for both LOAD DATA INFILE and INSERT, enlarge the key cache by increasing the key_buffer_size system variable

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using asp.net + Mysql. I have multiple rows in my dataset; I
I have MySQL running with the ASP Membership Schema I have installed the connector,
I have an ASP.net project I'm looking at and they want to use MySQL.
I have an ASP.Net website which uses a MySQL database for the back end.
I have an asp.net page connected to a MySql DB. When I try to
I am developing a MySQL Web App using ASP.net and I have heard that
I have an ASP.NET website that uses mysql as it's database. I notice there
i have project in ASP.NET MVC 3 and a mysql database that contains a
I have mysql database i.e. central database and i use ASP .net. I want
I'm using MySql in my asp.net project. But I don't want to type every

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.