Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
SQL deletes all rows and creates new rows for each change to the data #1589
When using the SQL database I have found that everytime any data is updated and saved the program deletes all existing rows from dbo.tblCons and creates a full set of new rows.
This causes the database to grow to a tremendous size very quickly when working with a small team even though the total number of rows is small. For example in 4 months my database of 40 rows is sitting at ID number 6619 as the latest increment. This causes simple queries like (select * from tblCons) to take up to 15 minutes to run. Shrinking the database did not help, however (UPDATE STATISTICS tblCons) did reduce the query time down to 5 minutes for the duration of the session.
Workaround has been to delete the database periodically and reimport the rows into a fresh database.
To solve I believe that changes to existing rows should be made by performing an UPDATE statement for that value on that row rather than deleting all the rows from the database and creating 40 new rows.