473,748 Members | 2,328 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

data deletions

Quick question about deleting data from SQL Server.

We have a table that gets quite a bit of activity with an attribute of
type text (inserts that store new text entries of 50-200k apiece).
Older rows aren't needed so we have a process that deletes rows more
than 30 days old (using delete statements).

When these rows are deleted, is the memory consumed by these
automatically recovered? Or is there some process that must be
performed to recover the space? What about the transaction log? Does
that grow with each deletion? When do transaction logs get reset?

Thanks,
John

Jul 23 '05 #1
2 1301
Unless you have transactions logs turned off what you delete will be
recorded in them until you do a backup of the transaction logs. Almost
any change you make to the database will recorded in the transaction
log. If you are not already having problems with the disk filling up
then you probably already are backing up the transaction log.

While a cache may reside in memory it will automaticly be removed when
other queries need the memory. As for disk space yes it will be
reused, however if you need to free the disk space you can do a shrink
of the database, right click on database or table in enterprise
manager. However backup your transaction log before doing this to
really free up more space.

Jul 23 '05 #2
(jo************ @inginix.com) writes:
We have a table that gets quite a bit of activity with an attribute of
type text (inserts that store new text entries of 50-200k apiece).
Older rows aren't needed so we have a process that deletes rows more
than 30 days old (using delete statements).

When these rows are deleted, is the memory consumed by these
automatically recovered? Or is there some process that must be
performed to recover the space?
It depends a little. SQL Server allocates space for a table in extents
of 8*8192 bytes at a time. Such an extend is automatically deallocated
when there is no longer any data in the extent. Thus, if you deletes
are very well aligned with the extents, the space will get reclaimed.
Whether they are aligned depends on the clustered index. If the
clustered index on a column that gorws with each insert, this is likely
to happen. If the clustered index is such that inserts and deletes
happen all over the place, then no extents will be released. However,
in this case space within the extents is likely to be reused by new rows.

The worst case is if you don't have any clustered index. In this case,
the tables grows in one end, but space may not always be reclaimed.

You can check your table for fragmentation with DBCC SHOWCONTIG.

One way to reclaim space is to periodically run DBCC DBREINDEX on
the table. This defragments the table.
What about the transaction log? Does that grow with each deletion?
When do transaction logs get reset?


If you use simple recovery, the transaction log is truncated every
once in a while (about once a minute). It's never truncated past active
transactions though.

If you run with full or bulk-logged recovery, the transaction is truncated
on demand only. It is not specifically not truncated just because you
do a full backup of the database.
--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1425
by: stormogulen | last post by:
Hi! I'm hoping someone can help me come up with a 'best possible solution' for the following problem: I'm trying to design an addressbook, i.e a storage for adresses. I would like my adresses to have a random number of fields, all of which are strings. Futhermore every address can belong to zero or more categories (ie. friend, family etc.)
3
3174
by: Sigmathaar | last post by:
Hi, I'm need some advice about lists and vectors. I'm doing a program who needs to have sequential access of a non ordered unit of objects whose size decreases almost each time the sequence is finished (at the begining I have about 2500 objects in the unit, after the first acces I have 2499, then 2435, then 1720 and so on). The problem is that sometimes after a whole sequence the number of objects in the unit remains unchanged. After...
15
2561
by: philip | last post by:
On a form, I have a datagridview. This datagridview is constructed on a dataset filled by a tableadapter. The table adapter do very well what it must do when filling dataset. Insertions, modifications and deletions functions very well in the dataset. But impossible to transmit modifications in ACCESS database. Impossible to WRITE in database. Here is the code for data transmission from tableadapter to Access database :
9
1839
by: David Harris | last post by:
Ok, so I'm semi-new to .NET, having done everything manually with SQL code back in VB6. So before I program this up completely manually again, I thought I'd ask for better ways to think through this problem. We have several client machines, and a central data warehousing server. Each machine may contain hundreds of surveys, and they all are sent to the central server. Only they can never be networked together, forcing us to use files. I...
16
1937
by: Christian Christmann | last post by:
Hi, I'm looking for a data structure where I can store arbitrary elements and than efficiently check if an element (of same type as the stored elements) is contained in the list. The latter operation is performed pretty frequently, so the data structure I require must handle it with low komplexity. My idea was to use a STL set and then do something like
0
1129
by: JohnM | last post by:
I've produced a database to store data on behaviour incidents in our school. I'm having problems ensuring all staff can view and some staff edit. (I don't need the complex proper security) I approached it like this. Created a form which I'll call 'view' form 1) View Form has these propertis - Allow filters / edits No Deletions / additions / Data entry / Snapshot / No locks / Fetch defaults Yes Seems to stop anyone doing anything...
8
1753
by: Lykins | last post by:
We currently use Access 2003 in our company and have had this issues from every version from Access 97 to 2003. We deal with large databases and run a lot of queries over tables with millions of records in them. The problem comes in that when we pull a dataset out of a large table we do not get the same result every time. Example is transaction count for store 1 shows 3000 one time, the next run it is 3015, the next is 2089. All of...
6
7231
by: nukerdoggie | last post by:
My application consists of the following requirements: 1. The map container will be created in full at the start of the app and no insertions or deletions will occur throughout the life of the object. 2. Updates to data elements inside the map occur frequently. 3. Access to map "records" will need to be by key at times and at other times access will be sequential, starting from the first "record" and continuing thru to the last...
0
1760
by: Howard Swope | last post by:
I have an xml file that my application downloads on a periodic basis. I also have a dataset based on this that is used in the application. At present, the application takes the new downloaded xml, creates a data set from that and merges it with one in use. The ultimate goal is to have the update of the primary data set trigger change events based on only data that has changed (updates, additions, or deletions). I am thinking that I need...
0
9528
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9359
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9310
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6792
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6072
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4592
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4863
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3298
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2206
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.