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 990345
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T05:56:09+00:00 2026-05-16T05:56:09+00:00

First we get the max id from the ProductFileLocalName and then – 1000 (as

  • 0

First we get the max id from the ProductFileLocalName and then – 1000 (as we don’t want to delete the most recent additions as they might not be inserted in ProductFileInfo yet)

Then we pass the max id to this stored procedure:

DELETE TOP (10000)
FROM ProductFileLocalName WITH (ROWLOCK)
FROM ProductFileLocalName
    LEFT OUTER JOIN ProductFileInfo AS pfi WITH (NOLOCK) ON ProductFileLocalName.ProductFileLocalNameId = pfi.ProductFileLocalNameId
WHERE (ProductFileLocalName.ProductFileLocalNameId < @maxid AND pfi.ProductFileInfoId IS NULL);

Is this the most effective way to perform this operation?

  • 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-16T05:56:10+00:00Added an answer on May 16, 2026 at 5:56 am

    If you are really keeping just a 1000 out of a million, do you have an option to copy what you want to keep to a dual table (identical scehema) and then nuke the big one and copy back that small subset?. You would need to measure the timing for this option and check how long continuous delay dealy you can afford.

    Another option is to figure out a column that can serve as a partitioning column – assuming that these million records came in during some longer period of time, you can probably esablish safe timing limits and always go after older partition (or partitions), even detaching them first.

    As other folks mentioned, you need to put more concrete info into the question if you want people to ponder more particular scenarios instead of guessing – there’s no one single tactics for all big deletions.

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

Sidebar

Related Questions

i want to get first n words from text stored in my database without
This is very basic magento question i guess. I want to first get all
I want to get first and last name of a google account using gdata
I am trying to get the max id of the first n id's in
I'm trying to get the max of column: select * from ( select col1,
I want to get only winners in mysql table. SELECT mayor_id, local_unit_id, Value FROM
I want to get the maximum id of row data. In my table first
i have the following code which will get the max and min values from
I want to find the fastest way to get the min and max of
I want to make a MySQL to get daily differential values from a table

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.