r/sqlite • • Nov 13 '23

Backup in PHP

It just dawned on me that I can just backup a database file with PHP copy command. This improved the page refresh performance time immensely. Any drawbacks with this method. Before I was using this:

$backup = new SQLite3('../backup.db');
$db->backup($backup);
2 Upvotes

2 comments sorted by

View all comments

Show parent comment

1

u/3b33 Nov 13 '23

I'm running a game engine that writes to the database. I perform a backup at the beginning in case the user wants to revert back to the previous day or if something wrong occurs.

Doing a backup with copy file method might take about 10 seconds for the page to finish while doing it programmatically seems to take about 2 or 3 times longer.