Be careful with the last n rows approach, you have to have an understanding of how the query scales to do this effectively (ie. your n rows are at an appropriate scale to optimise). I assume that if you are at a small enough scale that you are asking this question, restoring the whole backup is the best option.
This is infrastructure level stuff that someone else should run.
so most of the time, both things are good.
there is also:
- Barman
- pg_probackup
(P.S: with archiving you can even have a "delayed" downstream cluster)
For SQL optimization purposes, you cannot do that – there are high chances you'll get different query plans.
And as I already mentioned in my other comments here, thin cloning is a great way to solve the speed (and money) problem for larger DBs.
If the database is too big, just use last N amount of rows from the database instead of a full dump.
Bonus points if you log actual SQL queries that happen in production to a log file, so you can then re-run last X queries against your new test-production database and log the total run time. After doing bunch of optimizations, you can re-run your little benchmark and see how it compares.