If I want to allow a user to upload a video in a post, then what's the best way to store it so that I can access it later? I am currently just using a INSERT query to upload it to a PostGres SQL database field, but it's extremely slow.
Is there another method or best practice to store large files like this and access it quickly and efficiently?
var video = videoFile ? "'\\x" + videoFile.buffer.toString('hex') + "'" : "NULL";
let insertQuery = "INSERT INTO posts (video) VALUES(" + video + ") RETURNING *";
Above is the code I'm using right now to insert the file into the database.