What happens to the statistics when a DB is restored?

  • HI All

    The question is what happens to the statistics information , when a database is restored from an environment to the other without the stats related configuration in the Restore command.

    Also where are these statistics stored in the db?

    The reason for this question is , recently we restored a production db to test environment and found that the stats are all outdated.Should they have not come over with the DB itself?

  • The database backup is a copy of the database as is . The statistics will not under go any change from that of the original database from which the backup was taken.

    Have you checked the stats on the prodcution database?

    Jayanth Kurup[/url]

  • Sometimes i have seen the restoration happened from lower version to higher version has this problem.

    Muthukkumaran Kaliyamoorthy
    https://www.sqlserverblogforum.com/

  • Production stats are pretty much uptodate.

  • koustav_1982 (8/16/2011)


    HI All

    The question is what happens to the statistics information , when a database is restored from an environment to the other without the stats related configuration in the Restore command.

    Also where are these statistics stored in the db?

    The reason for this question is , recently we restored a production db to test environment and found that the stats are all outdated.Should they have not come over with the DB itself?

    The backup / restore stats command only keeps you posted about the progress of the command (10% done). Nothing to do with real stats.

    The restore is a perfect copy of the db at the end of the backup. Index, stats & all.

  • Statistics are stored with the database. They will be the same on the restored database as they were on the backed up database. This is true even between versions, except, if you restore to a new version the stats will be rebuilt as they get accessed because they are stored differently in newer versions of SQL Server. But the restore operation doesn't affect statistics, ever.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply