Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12»»

How we dealocate the memory of a row Expand / Collapse
Author
Message
Posted Tuesday, January 10, 2012 12:20 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, January 12, 2012 3:23 AM
Points: 4, Visits: 6
How we dealocate the memory of a row in a table in sql 2008 R2. please show the query if exist.
Post #1232956
Posted Tuesday, January 10, 2012 12:25 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Yesterday @ 8:46 AM
Points: 2,663, Visits: 5,617
There is not normally a need to. What exactly makes you think you should need to do this - especially fo rone row?

Normally the space will be reused a new rows are added/deleted etc. Under rare situations such as a heap table and all new data being added then huge deletes of old data you can end up with a large number of empty pages. These will be used if new rows are added or you can create a clustered index on the table to restructure it.


Mike John




Post #1232957
Posted Tuesday, January 10, 2012 2:59 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Yesterday @ 2:55 PM
Points: 41,570, Visits: 34,495
Can you explain further what you want to do?


Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #1233009
Posted Wednesday, January 11, 2012 6:48 AM


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Yesterday @ 9:47 PM
Points: 4,135, Visits: 5,855
chaudharydpk0 (1/10/2012)
How we dealocate the memory of a row in a table in sql 2008 R2. please show the query if exist.


You cannot do this. But like Gail I want to know WHY you THINK you want to do this. There is likely something else at play here that we could address for you.


Best,

Kevin G. Boles
SQL Server Consultant
SQL MVP 2007-2012
TheSQLGuru at GMail
Post #1233938
Posted Wednesday, January 11, 2012 7:39 AM


UDP Broadcaster

UDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP Broadcaster

Group: General Forum Members
Last Login: Yesterday @ 4:42 PM
Points: 1,495, Visits: 4,314
chaudharydpk0 (1/10/2012)
How we dealocate the memory of a row in a table in sql 2008 R2. please show the query if exist.

OK, I'll take a stab at interpreting your request literally. When you ask how to "dealocating the memory of a row", perhaps you're asking how to deallocate memory from the buffer pool where SQL Server caches pages. SQL Server caches data at the page level, not the row level.

DBCC DROPCLEANBUFFERS
http://msdn.microsoft.com/en-us/library/ms187762.aspx



"Winter Is Coming" - April 6, 2014
Post #1233980
Posted Thursday, January 12, 2012 1:07 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, January 12, 2012 3:23 AM
Points: 4, Visits: 6
Sir, actually i delete 5000 rows in my table in sql 2008 r2 but after that the table size in unchanged.
Post #1234552
Posted Thursday, January 12, 2012 1:12 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, January 12, 2012 3:23 AM
Points: 4, Visits: 6

Sir, actually i deleted 5000 rows in my table in sql 2008 r2 but after that the table size in unchanged. I daily need to delete thousand's record in a table and in next day fill up with new data either same size or less or more size.
Post #1234554
Posted Thursday, January 12, 2012 1:42 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Monday, April 14, 2014 2:19 AM
Points: 1,101, Visits: 5,271
chaudharydpk0 (1/12/2012)

Sir, actually i deleted 5000 rows in my table in sql 2008 r2 but after that the table size in unchanged. I daily need to delete thousand's record in a table and in next day fill up with new data either same size or less or more size.

How did you check the table size?
Are are talking about datable files (.mdf/.ndf/.ldf) by any chance?
Post #1234562
Posted Thursday, January 12, 2012 1:54 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, January 12, 2012 7:08 AM
Points: 2, Visits: 131
Sounds like you are expecting the data files to automaticallly shrink, which does not happen unless explicitly set at the database level or requested on an ad-hoc bases.

Try DBCC SHRINKFILE

Use the TRUNCATEONLY option first, this should shrink the file providing the data you are deleting was more or less the last quantity of data that was inserted. Truncate will remove the free space from the end of the file and is instant, a normal shrink to a specific size will involve shuffle the data pages and this is very resource / time consuming.

For more info:
http://msdn.microsoft.com/en-us/library/ms189493.aspx

Rob
Post #1234567
Posted Thursday, January 12, 2012 2:44 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Yesterday @ 2:55 PM
Points: 41,570, Visits: 34,495
chaudharydpk0 (1/12/2012)
Sir, actually i delete 5000 rows in my table in sql 2008 r2 but after that the table size in unchanged.


Nothing unusual there. The deleted rows are scattered throughout the table. Rebuild your clustered index and the table size will drop. Avoid shrink unless you absolutely must release the space to the OS. It's better to leave free space within the database for future use. Also, unless you first rebuild the index, there will be no free pages for shrink to release as the free space will be spread throughout the table.



Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #1234594
« Prev Topic | Next Topic »

Add to briefcase 12»»

Permissions Expand / Collapse