I have a large table that I recently purged a year of data from.
However, the table size in sp_spaceused hasn't decreased as much as I
would expect. (there are no text or large object columns on this
table, BTW) Running sp_spaceused on the table shows the following.
rows reserved data index size unused
TABLE_NAME 23470880 67790808 KB 18116312 KB 3211616 KB 46462880 KB
I ran a dbcc indexdefrag on all indexes on the table last night,
including the clustered index, and I'm still seeing pretty much the
same amount of space reported as unused.
The one thing that I haven't done yet is to run the sp_spaceused on
this table with the @updateusage flag set to true as I need to do this
afterhours to reduce contention. I will attempt this tonight and
report on the results.
Here's DBCC SHOWCONTIG OUTPUT for the table:
DBCC SHOWCONTIG scanning 'TABLE_NAME' table...
Table: 'TABLE_NAME' (917578307); index ID: 1, database ID: 7
TABLE level scan performed.
- Pages Scanned........ ............... .........: 2264447
- Extents Scanned........ ............... .......: 285484
- Extent Switches....... ............... ........: 287092
- Avg. Pages per Extent......... ............... : 7.9
- Scan Density [Best Count:Actual Count].......: 98.59%
[283056:287093]
- Logical Scan Fragmentation ............... ...: 0.04%
- Extent Scan Fragmentation ............... ....: 3.19%
- Avg. Bytes Free per Page........... ..........: 2418.9
- Avg. Page Density (full)......... ............: 70.12%
DBCC execution completed. If DBCC printed error messages, contact your
system administrator.
Looking through the history of the group, the one thing that seems to
remedy this problem consistantly is to bcp out all the data, trunc the
table and bcp all the data back in. This is not really a possibility
for me due to the size of the table and the availability expectations
of my customers. Is there anything that I forgot to check? Do you
think that it's just a matter of incorrect statistics in sp_spaceused?
Thanks in advance:
Matt 4 7067
Try running sp_spaceused with the true parameter. For example:
sp_spaceused TABLE_NAME, true
Hope this helps,
Gert-Jan
spilich wrote: I have a large table that I recently purged a year of data from. However, the table size in sp_spaceused hasn't decreased as much as I would expect. (there are no text or large object columns on this table, BTW) Running sp_spaceused on the table shows the following.
rows reserved data index size unused TABLE_NAME 23470880 67790808 KB 18116312 KB 3211616 KB 46462880 KB
I ran a dbcc indexdefrag on all indexes on the table last night, including the clustered index, and I'm still seeing pretty much the same amount of space reported as unused.
The one thing that I haven't done yet is to run the sp_spaceused on this table with the @updateusage flag set to true as I need to do this afterhours to reduce contention. I will attempt this tonight and report on the results.
Here's DBCC SHOWCONTIG OUTPUT for the table: DBCC SHOWCONTIG scanning 'TABLE_NAME' table... Table: 'TABLE_NAME' (917578307); index ID: 1, database ID: 7 TABLE level scan performed. - Pages Scanned........ ............... .........: 2264447 - Extents Scanned........ ............... .......: 285484 - Extent Switches....... ............... ........: 287092 - Avg. Pages per Extent......... ............... : 7.9 - Scan Density [Best Count:Actual Count].......: 98.59% [283056:287093] - Logical Scan Fragmentation ............... ...: 0.04% - Extent Scan Fragmentation ............... ....: 3.19% - Avg. Bytes Free per Page........... ..........: 2418.9 - Avg. Page Density (full)......... ............: 70.12% DBCC execution completed. If DBCC printed error messages, contact your system administrator.
Looking through the history of the group, the one thing that seems to remedy this problem consistantly is to bcp out all the data, trunc the table and bcp all the data back in. This is not really a possibility for me due to the size of the table and the availability expectations of my customers. Is there anything that I forgot to check? Do you think that it's just a matter of incorrect statistics in sp_spaceused?
Thanks in advance: Matt
--
(Please reply only to the newsgroup)
> I have a large table that I recently purged a year of data from. However, the table size in sp_spaceused hasn't decreased as much as I would expect. (there are no text or large object columns on this table, BTW) Running sp_spaceused on the table shows the following.
Hi Matt,
I had a similar situation. I inherited a database with a lot of
unused space. It turns out the tables had non-clustered indexes but
no clustered index. When I changed one of the NC index to a clustered
index, all of the unused space went away.
Sorry, I missed the part where you mentioned you already had a
clustered index. Did you try DBCC Shrinkfile?
I ran sp_spaceused with the @updateusage flag set to true and that
fixed the output from sp_spaceused to be what I expected. Thanks for
the suggestions. Does anyone run this on a scheduled basis to keep
stats up to date? If so, how often?
Thanks This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: A.M. de Jong |
last post by:
Hi,
In our environment sp-spaceused returns:
Allocated: 500
Unallocated: -100
Enterprise Database Taskpad shows that our total database size = 400 MB
(320 used; 80 unused)
Windows Explorer shows also that MDF file is more or less 400 MB.
|
by: Brad Tobin |
last post by:
On a production database, there is a 2GB database, when I run
sp_spaceused it indicates a very high quanity of unused space. The
database has been shrunk & free space sent to the OS. Why is this
value so high, what can I do to reclaim the space?
database_name database_size unallocated space
------------------------------------------------------------------------------
DB_00001 2004.13 MB 49.64 MB
|
by: Robin Tucker |
last post by:
I want to look at the size of the current database, so I can create a new
one if it gets too big (we are working around the 2gb MSDE limit for our
customers).
I would like to do something like this:
DECLARE @size INTEGER
execute BLOB0000.dbo.sp_spaceused
|
by: Hennie de Nooijer |
last post by:
Hi
I'm executing SP_SpaceUsed in a stored procedure like this :
Exec ('SP_SpaceUsed '+ @table)
This works great but when i want to execute it for a table in a other
database i'm running in to troubles. Things i tried is this :
Exec ('USE <DB> ; SP_SpaceUsed '+ @table) -->not working (uncorrect
|
by: Jonathan LaRosa |
last post by:
Hi all -
I'm wondering if anyone has (or knows of) a tool that will allow me to
search through VB code, tables, queries, reports, forms, and other
objects, for references to all other types of objects.
That's not really that clear, so here's an example:
If I have a table named
"table_i_would_like_to_delete_but_don't_know_if_any_object_is_using_it",
| |
by: Mike Thomas |
last post by:
Access 2000 - Is there a 3rd party tool available, or perhaps some method
built into Access 2000, which could isolate unused Access reports, queries,
forms, etc?
I have a 5 year old app which has not always been cleaned up. I know there
are quite a few such no longer used items. I have a "Find" utility which is
good, but I need to look for every component individually - it is very time
consuming because there are hundreds of components...
|
by: Russell Smith |
last post by:
Postgresql 7.4.5
The following VACUUMs were run within a couple of minutes of each other completing.
This table concerned is a table that has not been changed in a long time. (a month)
There were open transactions at the time the vacuum was run. These were created by having PHP running with
postgresql. At least that is what I have managed to find so far. and disabling PHP in apache removes them.
postgres 7588 0.0 0.4 50324 3168 ? ...
|
by: zacks |
last post by:
Suddenly, in a VB2005 project I am working on, several variables show
up in the list of warnings are being unused local variables. But they
all are. Several of them are the ex variable used in a Try/Catch, and
the Catch for each one references the ex exception variable. Yet it is
still flagged as unused? What gives?
|
by: nickvans |
last post by:
Hi all,
I have a table called tblRecords that has "DashNum" as its primary key. The lowest value of this table is 116 and the highest value is 269, though there are some missing values. It is expected that records will be removed in the future, leaving more missing values. I would like to have a text box have as its default value the first unused entry in this table.
I found a way to do this, but its not very efficient and requires an...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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...
| |
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...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |