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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T04:04:26+00:00 2026-05-29T04:04:26+00:00

i am running a stored procedure to delete data from two tables: delete from

  • 0

i am running a stored procedure to delete data from two tables:

delete from TESTING_testresults
from TESTING_testresults
inner join TESTING_QuickLabDump
on TESTING_QuickLabDump.quicklabdumpid = TESTING_TestResults.quicklabdumpid
where TESTING_quicklabdump.[Specimen ID]=@specimen



delete from TESTING_QuickLabDump
from TESTING_Quicklabdump
where [specimen id]=@specimen

one table is 60m rows and the other is about 2m rows

the procedure takes about 3 seconds to run.

is there any way i can speed this up? perhaps using EXISTS?

meaning IF EXISTS...THEN DELETE – because the delete should not be occurring every single time

something like this

if @specimen exists in TESTING_QuickLabDump then do the procedure with the two deletes

thank you !!!

  • 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-29T04:04:27+00:00Added an answer on May 29, 2026 at 4:04 am

    For a table with 60 mil rows I would definitely look into partitioning the data horizontally and/or vertically. If it’s time-sensitive data then you ought to be able to move old data into a history table. That’s usually the first and most obvious thing people do so I would imagine if that were a possibility you would have already done it.

    If there are many columns then it would definitely benefit you to denormalize the data into multiple tables. If you did this, I would suggest renaming the tables and creating a view of all the partitioned tables named after the original table. Doing that should ensure existing code isn’t broken.

    If you ‘really’ want to fine tune the speed then you should look into getting a faster hard drive and learn a little about hard drives work. Whether the data is stored towards the inner or outer section of the hd will affect speed of access slightly for example. And solid state hard drives have come a long way so you might look into getting one of those.

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

Sidebar

Related Questions

I have created a stored procedure to delete data from multiple tables. my work
I am running the following stored procedure to delete large number of records. I
I have a somewhat-long-running stored procedure being called from a PB application. I want
I'm running a stored procedure with multiple joins with one table that contains over
I'm running a stored procedure that involves more tables placed in joins. My stored
I have a very long-running stored procedure in SQL Server 2005 that I'm trying
I'm running a stored procedure through L2S and it's returning 'Specified cast is not
I've got a T-SQL stored procedure running on a Sybase ASE database server that
I'm running a long process stored procedure. I'm wondering if in case of a
How can I know which stored procedure is running in SQL Server 2005. And

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.