Sql-server – Restoring database with less data than the backup file

backuprestoresql serversql-server-2012

I'm not really experienced with DBA and SQL, so I need some recommendations from you.

I have a production database backup file, however it is very large, so when I'm executing restore, for example, making a copy of data in testing environment – it takes ages to restore.

I read this: Is a partial restore of data from backup possible?

It is similar to what I want to do, but not exactly equivalent.

To be clear, I need an answer to the following question: is there any possibility to restore database with fewer records than in the backup file?

For instance, if the backup file table contains 1 million records, I just want to restore only 1k records.

Best Answer

No, it is not possible to only restore n number of rows from a given table. The restore process does not even know about the tables, let alone how many rows are in each table, as it works on the database page level.

To accomplish your goal of only getting n number of rows from production to non-production without doing a full restore you'll probably want to set up an ETL process.