What is the TSQL format STATS_STREAM (undocumented function)? Does it contain all the statistics?

I have a huge table on one server, and I need to copy the table to the production server. I can do this, but then I need to create statistics that will take a lot of time in the system, which I do not want to ask to handle a lot of work. If I move the entire database, I need to delete the system in order to delete the existing database, which does not matter.

Pinal Dave has a post, http://blog.sqlauthority.com/2011/01/05/sql-server-copy-statistics-from-one-server-to-another-server/ In this article he describes how to copy statistics from one table to a new one, using Microsoft's “Generate Scripts”, which allows you to copy using the undocumented function STATS_STREAM. This is for a new table. I'm not sure if I can create a table with statistics, and then write in all the data, as this should make the system want to update the statistics - perhaps even if I have disabled auto-generation statistics.

I use the following code: (The table is InvTbl, and the statistics for this table that I am updating are GammaTheta. The statistics exist, and there is data.)

Update STATISTICS dbo.InvTbl [GammaTheta]  WITH STATS_STREAM = 0x0100002000...

First, does anyone know if Stats_Stream contains all statistics data? Then, what is important, how is it stored in binary format?

Note. The table contains the statistical distribution of two variables, which we look at based on the union, and has some really important functions about the distribution of input data. It is static and I will never have to recalculate values ​​or statistics after loading. Do not use fullscan - this is not an option based on testing, since the connection speed affects.

Note 2: No, the number does not end with an ellipsis. I turned off the data.

+3
source share
1 answer

, ( ). . .

+3

All Articles