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

  • Home
  • SEARCH
  • 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 8851491
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:10:05+00:00 2026-06-14T13:10:05+00:00

I have foreign keys set up for cascading deletes and it is taking about

  • 0

I have foreign keys set up for cascading deletes and it is taking about 30 minutes for a delete command to run. Here is a simplified view of that I am deleting with a row count:

DELETE from Directories WHERE Type = 1

Structure:

Directory table: (1.2K rows returned from WHERE clause)

+—+ File table with DirectoryID foreign key (50K rows)

+————-+ Tag table with FileID foreign key (28K rows)

This is taking 28 minutes to run.

Should I avoid using cascading deletes with many tiers or is there something simple I can do to improve performance? Without foreign keys, I can delete 50K+ rows in less than a second.

I’m new to both SQL and SQL Server Compact Edition 3.5. All of the primary keys are indexed. I’ve added indexes on the foreign keys which did not help. Any help would be appreciated.

  • 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-06-14T13:10:07+00:00Added an answer on June 14, 2026 at 1:10 pm

    According to this discussion, if you have composite indexes on your foreign keys you might want to look into having simple indexes that include only the foreign key field.

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

Sidebar

Related Questions

I have an admin view which contains four foreign keys each with a few
I have a set of tables in MySQL like this (foreign keys referenced by
I have a set of tables which are connected through foreign keys , and
I have lots of tables with lots of foreign keys and about all of
I have these tables places(place_id, place_name) places_criteria(place_id, criterion_id) criteria(criterion_id, criterion_name) places_criteria have foreign keys
I have a relational table with two foreign-keys pointing to same table. The first
I have some innoDbs with only 2 int columns which are foreign keys to
The consensus seems to be that all foreign keys need to have indexes. How
I've been reading up on foreign keys and joins recently, and have been pleasantly
Let's say I have a Person class and an Order class, with foreign keys

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.