Showing posts with label number. Show all posts
Showing posts with label number. Show all posts
Tuesday, March 27, 2012
estimate size of table based on number of rows
Hi everyone,
This might be a tough one, I don't know if this is doable.
Basically I want to create a stored procedure to return estimated size of a
table.
because I don't know how many rows it will have in the future, I want to
calcuate how much disk space it takes to have one row,
then multiply by number of rows I specified. (space calculation for index is
not necessary).
EXEC GetEstimateTableSize @.TableName='Table1', @.NumberOfRows ='3000000'
it'll return value in KBs after I execute proc. possible?If you run :
EXEC dbo.sp_spaceused table_name
You get the current space usage. Divide it by the current number of rows,
and multiply by the projected one.
If the table is completely empty or you'd rather calculate theoretical size,
there are formulas you can use from BOL, or better yet, a lengthy discussion
on internal structures and row sizes in Inside SQL Server 2000.
BG, SQL Server MVP
www.SolidQualityLearning.com
"Britney" <britneychen_2001@.yahoo.com> wrote in message
news:uWKIMMBpFHA.3936@.TK2MSFTNGP10.phx.gbl...
> Hi everyone,
> This might be a tough one, I don't know if this is doable.
> Basically I want to create a stored procedure to return estimated size of
> a table.
> because I don't know how many rows it will have in the future, I want to
> calcuate how much disk space it takes to have one row,
> then multiply by number of rows I specified. (space calculation for index
> is not necessary).
>
> EXEC GetEstimateTableSize @.TableName='Table1', @.NumberOfRows ='3000000'
>
> it'll return value in KBs after I execute proc. possible?
>
>
>
>
>
>|||Have you looked in the Books Online for sp_spaceused? It'll get you
part of the way there because it returns the rows used and the current
size of the table. Here's a quick and dirty stab at it; obviously
it'll need polishing:
This is actually a pretty useful idea; I'm planning on using this
myself.
Stu
DECLARE @.Table varchar(255)
DECLARE @.NumberOfRows int
SET @.Table = 'Splat'
SET @.NumberOfRows = 1
CREATE TABLE #t (name varchar(255),
rows int,
reserved varchar(100),
data varchar(100),
index_size varchar(100),
unused varchar(100))
--how big is the table now?
exec sp_spaceused @.Table
INSERT INTO #t
exec sp_spaceused @.Table
--strip off the ' KB' from the data column
--convert data and rows to decimal, and
--divide data by number of rows and multiply by number of anticipated
rows
SELECT rows, data, (data/rows) * @.NumberOfRows
FROM ( SELECT rows = CONVERT(decimal(32,3), rows),
data = CONVERT(decimal(32,3), LEFT(data, LEN(data)-3))
FROM #t) x
DROP TABLE #t
HTH,
Stu|||The following may help:
http://www.microsoft.com/downloads/...&displaylang=en
If you need it in a SP, try to understand the formulas used in the
spreadsheet and translate them in T-SQL (using the data from syscolumns
and other system tables).
Razvan|||I see 4 columns called reserved , index_size, unused, data
I guess I need to add 4 columns to get the total size, then divide by number
of row to find out how much disk space per row?
then disk space per row * estimate number of rows to find out estimate size?
"Itzik Ben-Gan" <itzik@.REMOVETHIS.SolidQualityLearning.com> wrote in message
news:etjHceBpFHA.2888@.TK2MSFTNGP10.phx.gbl...
> If you run :
> EXEC dbo.sp_spaceused table_name
> You get the current space usage. Divide it by the current number of rows,
> and multiply by the projected one.
> If the table is completely empty or you'd rather calculate theoretical
> size, there are formulas you can use from BOL, or better yet, a lengthy
> discussion on internal structures and row sizes in Inside SQL Server 2000.
> --
> BG, SQL Server MVP
> www.SolidQualityLearning.com
>
> "Britney" <britneychen_2001@.yahoo.com> wrote in message
> news:uWKIMMBpFHA.3936@.TK2MSFTNGP10.phx.gbl...
>|||You need the data + index_size.
Reserved includes: data + index_size + unused.
BG, SQL Server MVP
www.SolidQualityLearning.com
"Britney" wrote:
> I see 4 columns called reserved , index_size, unused, data
> I guess I need to add 4 columns to get the total size, then divide by numb
er
> of row to find out how much disk space per row?
> then disk space per row * estimate number of rows to find out estimate siz
e?
> "Itzik Ben-Gan" <itzik@.REMOVETHIS.SolidQualityLearning.com> wrote in messa
ge
> news:etjHceBpFHA.2888@.TK2MSFTNGP10.phx.gbl...
>
>|||but I have a NTEXT column,
I don't think it can calculate NTEXT.
"Razvan Socol" <rsocol@.gmail.com> wrote in message
news:1124386169.690259.289640@.z14g2000cwz.googlegroups.com...
> The following may help:
> http://www.microsoft.com/downloads/...&displaylang=en
> If you need it in a SP, try to understand the formulas used in the
> spreadsheet and translate them in T-SQL (using the data from syscolumns
> and other system tables).
> Razvan
>|||Indeed, ntext columns are not covered by the spreadsheed.
In the DataSizer.doc file, they wrote:
The tool does not include the formula to estimate the size of a table
that has Text columns. Not NULL text values consume 16 bytes in the
data row and have a minimum size of 84 bytes on the text page. Text
values are packed onto text pages with the same algorithm as data
rows so it should be possible to estimate the size of text data
storage using the HEAP table spreadsheet if you know the average size
of your text values.
Razvan|||if I use sp_spaceused 'tablename' command,
if that table has a few NText Columns,
I think it will calculate total spaces including disk spaces for NTEXT
column, correct?
"Razvan Socol" <rsocol@.gmail.com> wrote in message
news:1124483366.622335.202490@.g49g2000cwa.googlegroups.com...
> Indeed, ntext columns are not covered by the spreadsheed.
> In the DataSizer.doc file, they wrote:
> The tool does not include the formula to estimate the size of a table
> that has Text columns. Not NULL text values consume 16 bytes in the
> data row and have a minimum size of 84 bytes on the text page. Text
> values are packed onto text pages with the same algorithm as data
> rows so it should be possible to estimate the size of text data
> storage using the HEAP table spreadsheet if you know the average size
> of your text values.
> Razvan
>
This might be a tough one, I don't know if this is doable.
Basically I want to create a stored procedure to return estimated size of a
table.
because I don't know how many rows it will have in the future, I want to
calcuate how much disk space it takes to have one row,
then multiply by number of rows I specified. (space calculation for index is
not necessary).
EXEC GetEstimateTableSize @.TableName='Table1', @.NumberOfRows ='3000000'
it'll return value in KBs after I execute proc. possible?If you run :
EXEC dbo.sp_spaceused table_name
You get the current space usage. Divide it by the current number of rows,
and multiply by the projected one.
If the table is completely empty or you'd rather calculate theoretical size,
there are formulas you can use from BOL, or better yet, a lengthy discussion
on internal structures and row sizes in Inside SQL Server 2000.
BG, SQL Server MVP
www.SolidQualityLearning.com
"Britney" <britneychen_2001@.yahoo.com> wrote in message
news:uWKIMMBpFHA.3936@.TK2MSFTNGP10.phx.gbl...
> Hi everyone,
> This might be a tough one, I don't know if this is doable.
> Basically I want to create a stored procedure to return estimated size of
> a table.
> because I don't know how many rows it will have in the future, I want to
> calcuate how much disk space it takes to have one row,
> then multiply by number of rows I specified. (space calculation for index
> is not necessary).
>
> EXEC GetEstimateTableSize @.TableName='Table1', @.NumberOfRows ='3000000'
>
> it'll return value in KBs after I execute proc. possible?
>
>
>
>
>
>|||Have you looked in the Books Online for sp_spaceused? It'll get you
part of the way there because it returns the rows used and the current
size of the table. Here's a quick and dirty stab at it; obviously
it'll need polishing:
This is actually a pretty useful idea; I'm planning on using this
myself.
Stu
DECLARE @.Table varchar(255)
DECLARE @.NumberOfRows int
SET @.Table = 'Splat'
SET @.NumberOfRows = 1
CREATE TABLE #t (name varchar(255),
rows int,
reserved varchar(100),
data varchar(100),
index_size varchar(100),
unused varchar(100))
--how big is the table now?
exec sp_spaceused @.Table
INSERT INTO #t
exec sp_spaceused @.Table
--strip off the ' KB' from the data column
--convert data and rows to decimal, and
--divide data by number of rows and multiply by number of anticipated
rows
SELECT rows, data, (data/rows) * @.NumberOfRows
FROM ( SELECT rows = CONVERT(decimal(32,3), rows),
data = CONVERT(decimal(32,3), LEFT(data, LEN(data)-3))
FROM #t) x
DROP TABLE #t
HTH,
Stu|||The following may help:
http://www.microsoft.com/downloads/...&displaylang=en
If you need it in a SP, try to understand the formulas used in the
spreadsheet and translate them in T-SQL (using the data from syscolumns
and other system tables).
Razvan|||I see 4 columns called reserved , index_size, unused, data
I guess I need to add 4 columns to get the total size, then divide by number
of row to find out how much disk space per row?
then disk space per row * estimate number of rows to find out estimate size?
"Itzik Ben-Gan" <itzik@.REMOVETHIS.SolidQualityLearning.com> wrote in message
news:etjHceBpFHA.2888@.TK2MSFTNGP10.phx.gbl...
> If you run :
> EXEC dbo.sp_spaceused table_name
> You get the current space usage. Divide it by the current number of rows,
> and multiply by the projected one.
> If the table is completely empty or you'd rather calculate theoretical
> size, there are formulas you can use from BOL, or better yet, a lengthy
> discussion on internal structures and row sizes in Inside SQL Server 2000.
> --
> BG, SQL Server MVP
> www.SolidQualityLearning.com
>
> "Britney" <britneychen_2001@.yahoo.com> wrote in message
> news:uWKIMMBpFHA.3936@.TK2MSFTNGP10.phx.gbl...
>|||You need the data + index_size.
Reserved includes: data + index_size + unused.
BG, SQL Server MVP
www.SolidQualityLearning.com
"Britney" wrote:
> I see 4 columns called reserved , index_size, unused, data
> I guess I need to add 4 columns to get the total size, then divide by numb
er
> of row to find out how much disk space per row?
> then disk space per row * estimate number of rows to find out estimate siz
e?
> "Itzik Ben-Gan" <itzik@.REMOVETHIS.SolidQualityLearning.com> wrote in messa
ge
> news:etjHceBpFHA.2888@.TK2MSFTNGP10.phx.gbl...
>
>|||but I have a NTEXT column,
I don't think it can calculate NTEXT.
"Razvan Socol" <rsocol@.gmail.com> wrote in message
news:1124386169.690259.289640@.z14g2000cwz.googlegroups.com...
> The following may help:
> http://www.microsoft.com/downloads/...&displaylang=en
> If you need it in a SP, try to understand the formulas used in the
> spreadsheet and translate them in T-SQL (using the data from syscolumns
> and other system tables).
> Razvan
>|||Indeed, ntext columns are not covered by the spreadsheed.
In the DataSizer.doc file, they wrote:
The tool does not include the formula to estimate the size of a table
that has Text columns. Not NULL text values consume 16 bytes in the
data row and have a minimum size of 84 bytes on the text page. Text
values are packed onto text pages with the same algorithm as data
rows so it should be possible to estimate the size of text data
storage using the HEAP table spreadsheet if you know the average size
of your text values.
Razvan|||if I use sp_spaceused 'tablename' command,
if that table has a few NText Columns,
I think it will calculate total spaces including disk spaces for NTEXT
column, correct?
"Razvan Socol" <rsocol@.gmail.com> wrote in message
news:1124483366.622335.202490@.g49g2000cwa.googlegroups.com...
> Indeed, ntext columns are not covered by the spreadsheed.
> In the DataSizer.doc file, they wrote:
> The tool does not include the formula to estimate the size of a table
> that has Text columns. Not NULL text values consume 16 bytes in the
> data row and have a minimum size of 84 bytes on the text page. Text
> values are packed onto text pages with the same algorithm as data
> rows so it should be possible to estimate the size of text data
> storage using the HEAP table spreadsheet if you know the average size
> of your text values.
> Razvan
>
Wednesday, March 7, 2012
Errorlog retention
I am trying to change the default number of SQL errorlogs from 6 to 12. Does anyone know how to change that?EM>Management>Error Logs>Right click>Configure|||2 ways:
GUI - right-mouse click on SQL Server Logs under Management and select Configure
TSQL - ...forgot...looking...|||Thanks. looks like it issues this behind the scenes: xp_instance_regwrite N'HKEY_LOCAL_MACHINE', N'SOFTWARE\Microsoft\MSSQLServer\MSSQLServer', N'NumErrorlogs', REG_DWORD, 12
That will be helpful so I don't have to click 500 times for 100 servers.|||Thanks. looks like it issues this behind the scenes: xp_instance_regwrite N'HKEY_LOCAL_MACHINE', N'SOFTWARE\Microsoft\MSSQLServer\MSSQLServer', N'NumErrorlogs', REG_DWORD, 12
That will be helpful so I don't have to click 500 times for 100 servers.|||Thanks. looks like it issues this behind the scenes: xp_instance_regwrite N'HKEY_LOCAL_MACHINE', N'SOFTWARE\Microsoft\MSSQLServer\MSSQLServer', N'NumErrorlogs', REG_DWORD, 12
That will be helpful so I don't have to click 500 times for 100 servers.|||Almost forgot about this post! Here's a TSQL way of doing it (requires permissions, but I guess you're the admin, so go get it ;)):
xp_instance_regwrite N'HKEY_LOCAL_MACHINE', N'SOFTWARE\Microsoft\MSSQLServer\MSSQLServer', N'NumErrorlogs', REG_DWORD, <put_your_number_here>|||Yup, you beat me.
GUI - right-mouse click on SQL Server Logs under Management and select Configure
TSQL - ...forgot...looking...|||Thanks. looks like it issues this behind the scenes: xp_instance_regwrite N'HKEY_LOCAL_MACHINE', N'SOFTWARE\Microsoft\MSSQLServer\MSSQLServer', N'NumErrorlogs', REG_DWORD, 12
That will be helpful so I don't have to click 500 times for 100 servers.|||Thanks. looks like it issues this behind the scenes: xp_instance_regwrite N'HKEY_LOCAL_MACHINE', N'SOFTWARE\Microsoft\MSSQLServer\MSSQLServer', N'NumErrorlogs', REG_DWORD, 12
That will be helpful so I don't have to click 500 times for 100 servers.|||Thanks. looks like it issues this behind the scenes: xp_instance_regwrite N'HKEY_LOCAL_MACHINE', N'SOFTWARE\Microsoft\MSSQLServer\MSSQLServer', N'NumErrorlogs', REG_DWORD, 12
That will be helpful so I don't have to click 500 times for 100 servers.|||Almost forgot about this post! Here's a TSQL way of doing it (requires permissions, but I guess you're the admin, so go get it ;)):
xp_instance_regwrite N'HKEY_LOCAL_MACHINE', N'SOFTWARE\Microsoft\MSSQLServer\MSSQLServer', N'NumErrorlogs', REG_DWORD, <put_your_number_here>|||Yup, you beat me.
Errorlog increase Message Field
Is there away to increase the number of characters the
line displays or writes out in the Message field within
SQL Server Enterprise Manager 2000. It would be very
helpful to resolve locking problems.
Thank You,
DanRight Click on the Message and choose properties option - it should display
the full text.
Else you can directly open the file from C:\Program Files\Microsoft SQL
Server\MSSQL\LOG.
Please replace the directory structure as per your installation.
HTH
Satish Balusa
Corillian Corp.
"Dan" <anonymous@.discussions.microsoft.com> wrote in message
news:76ad01c3e762$f3c39bc0$a501280a@.phx.gbl...
Best idea is to run the below command from Query Analyzer, This will display
the entire contents of current SQL error log.
xp_readerrorlog
Thanks
Hari
MCDBA
"Dan" <anonymous@.discussions.microsoft.com> wrote in message
news:76ad01c3e762$f3c39bc0$a501280a@.phx.gbl...
line displays or writes out in the Message field within
SQL Server Enterprise Manager 2000. It would be very
helpful to resolve locking problems.
Thank You,
DanRight Click on the Message and choose properties option - it should display
the full text.
Else you can directly open the file from C:\Program Files\Microsoft SQL
Server\MSSQL\LOG.
Please replace the directory structure as per your installation.
HTH
Satish Balusa
Corillian Corp.
"Dan" <anonymous@.discussions.microsoft.com> wrote in message
news:76ad01c3e762$f3c39bc0$a501280a@.phx.gbl...
quote:|||Hi,
> Is there away to increase the number of characters the
> line displays or writes out in the Message field within
> SQL Server Enterprise Manager 2000. It would be very
> helpful to resolve locking problems.
> Thank You,
> Dan
>
>
Best idea is to run the below command from Query Analyzer, This will display
the entire contents of current SQL error log.
xp_readerrorlog
Thanks
Hari
MCDBA
"Dan" <anonymous@.discussions.microsoft.com> wrote in message
news:76ad01c3e762$f3c39bc0$a501280a@.phx.gbl...
quote:
> Is there away to increase the number of characters the
> line displays or writes out in the Message field within
> SQL Server Enterprise Manager 2000. It would be very
> helpful to resolve locking problems.
> Thank You,
> Dan
>
>
Errorlog increase Message Field
Is there away to increase the number of characters the
line displays or writes out in the Message field within
SQL Server Enterprise Manager 2000. It would be very
helpful to resolve locking problems.
Thank You,
DanRight Click on the Message and choose properties option - it should display
the full text.
Else you can directly open the file from C:\Program Files\Microsoft SQL
Server\MSSQL\LOG.
Please replace the directory structure as per your installation.
--
HTH
Satish Balusa
Corillian Corp.
"Dan" <anonymous@.discussions.microsoft.com> wrote in message
news:76ad01c3e762$f3c39bc0$a501280a@.phx.gbl...
> Is there away to increase the number of characters the
> line displays or writes out in the Message field within
> SQL Server Enterprise Manager 2000. It would be very
> helpful to resolve locking problems.
> Thank You,
> Dan
>
>|||Hi,
Best idea is to run the below command from Query Analyzer, This will display
the entire contents of current SQL error log.
xp_readerrorlog
Thanks
Hari
MCDBA
"Dan" <anonymous@.discussions.microsoft.com> wrote in message
news:76ad01c3e762$f3c39bc0$a501280a@.phx.gbl...
> Is there away to increase the number of characters the
> line displays or writes out in the Message field within
> SQL Server Enterprise Manager 2000. It would be very
> helpful to resolve locking problems.
> Thank You,
> Dan
>
>
line displays or writes out in the Message field within
SQL Server Enterprise Manager 2000. It would be very
helpful to resolve locking problems.
Thank You,
DanRight Click on the Message and choose properties option - it should display
the full text.
Else you can directly open the file from C:\Program Files\Microsoft SQL
Server\MSSQL\LOG.
Please replace the directory structure as per your installation.
--
HTH
Satish Balusa
Corillian Corp.
"Dan" <anonymous@.discussions.microsoft.com> wrote in message
news:76ad01c3e762$f3c39bc0$a501280a@.phx.gbl...
> Is there away to increase the number of characters the
> line displays or writes out in the Message field within
> SQL Server Enterprise Manager 2000. It would be very
> helpful to resolve locking problems.
> Thank You,
> Dan
>
>|||Hi,
Best idea is to run the below command from Query Analyzer, This will display
the entire contents of current SQL error log.
xp_readerrorlog
Thanks
Hari
MCDBA
"Dan" <anonymous@.discussions.microsoft.com> wrote in message
news:76ad01c3e762$f3c39bc0$a501280a@.phx.gbl...
> Is there away to increase the number of characters the
> line displays or writes out in the Message field within
> SQL Server Enterprise Manager 2000. It would be very
> helpful to resolve locking problems.
> Thank You,
> Dan
>
>
Friday, February 17, 2012
Error: Subreport could not be shown.
I have a problem with a report containing a number of subreports not running successfully when deployed to the Report Server.
The report runs successfully every time in the VS Development environment, so parameters are all setup correctly and the result is as expected accross the whole report.
No errors or warnings are listed when building or deploying.
All subreports are in the same project as the main report and deployed to the same folder in Report Manager. All the individual subreports run successfully both in VS Studio (Preview Tab) and in the Report Manager portal.
About 50% of the time, the main report runs but shows the error "Subreport could not be shown" for some or all of the subreports.
Running SQL 2005 SP1
Please advise.
Are any of the reports/subreports set to execute on a schedule or are cached?
and do they all have credentials stored?
|||Thanks for the reply.
Hi,
Can you be experiencing a parameter passing problem? Dates are always a little bit problemetic.
For one of my reports which I use date parameters and the date picker control of the SSRS 2005, the case is just the opposite. It fails on the VS2005 IDE, but runs successfully on the deployed Report Server.
Eralper
http://www.kodyaz.com
|||
Hi,
I don't think this is the issue, because all the subreports are driven by the same 3 parameters from the parent report, 2 of which are using the date picker control and it always works fine in VS. All of the subreports when run individually using the same parameters work fine.
Also, when it returns an error, which is only around half the time, generally the first 1 or 2 of 6 subreports is rendered correctly with the rest showing the error. I have reconciled the data results which are filtered by the parameters (Start & End dates) and the parameters are being correctly applied.
FYI, each subreport takes around 5 minutes to run individually, with the parent report averaging around 15-25 mins.
As a test, I deleted all the reports from the portal, rebuilt the solution and redeployed and everything was working as expected for several runs of the report including a snapshot via a linked report. Unfortunately, the problem has now re-occurred for no apparent reason.
I am begging to suspect resource related / timeout issues or some deloyment related issues but don't really understand why the report would be reliable in VS and not in the portal.
Any help appreciated.
PS: Re your experience, if you haven't already done so, refresh the datasets in VS then try previewing the report.
Subscribe to:
Posts (Atom)