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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T20:30:34+00:00 2026-05-16T20:30:34+00:00

I started an ASP.NET project with Entity Framework 4 for my DAL, using SQL

  • 0

I started an ASP.NET project with Entity Framework 4 for my DAL, using SQL Server 2008. In my database, I have a table Users that should have many rows (5.000.000 for example).

Initially I had my Users table designed like this:

Id  uniqueidentifier    
Name    nvarchar(128)   
Password    nvarchar(128)
Email   nvarchar(128)
Role_Id int 
Status_Id   int

I’ve modified my table, and added a MarkedForDeletion column:

Id  uniqueidentifier    
Name    nvarchar(128)   
Password    nvarchar(128)
Email   nvarchar(128)
Role_Id int 
Status_Id   int 
MarkedForDeletion   bit

Should I delete every entity each time, or use the MarkedForDeletion attribute. This means that I need to update the value and at some moment in time to delete all users with the value set to true with a stored procedure or something similar.

Wouldn’t the update of the MarkedForDeletion attribute cost the same as a delete 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-16T20:30:34+00:00Added an answer on May 16, 2026 at 8:30 pm

    Depending on the requirements/needs/future needs of your system, consider moving your ‘deleted’ entities over to a new table. Setup an ‘audit’ table to hold those that are deleted. Consider the case where someone wants something ‘restored’.

    To your question on performance: would the update be the same cost as a delete? No. The update would be a much lighter operation, especially if you had an index on the PK (errrr, that’s a guid, not an int). The point being that an update to a bit field is much less expensive. A (mass) delete would force a reshuffle of the data. Perhaps that job belongs during a downtime or a low-volume period.

    Regarding performance: benchmark it to see what happens! Given your table with 5 million rows, it’d be nice to see how your SQL Server performs, in its current state of indexes, paging, etc, with both scenarios. Make a backup of your database, and restore into a new database. Here you can sandbox as you like. Run & time the scenarios:

    • mass delete vs.
    • update a bit or smalldatetime field vs.
    • move to an audit table

    In terms of books, try:

    • this answer re: books
    • a recommendation for Adam Mechanic’s book
    • another question on database books.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I’ve only just started using ASP.NET MVC, and I have a somewhat trivial question:
We have a website running .NET 2.0 and have started using the ASP.Net HttpRuntime.Cache
I have a ASP.net (C#) project that is using a three layer architecture. I
I have a problem with a C# ASP .NET project in Visual Studio 2008
I've just started working on an ASP.NET project which I hope to open source
Our team is developing a rather big ASP.NET web project which initially started in
Have just started playing with ASP.NET MVC and have stumbled over the following situation.
I started switching some pre-existing nHibernate code in a Sharepoint-based ASP.NET project from eager
I've started working on an existing, large ASP.NET project and I'd love to get
i started an ASP.net web project app to learn how EF4 can be used.

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.