I had a similar issue, only my DB had close to 2 million files due to JPG Alerts (much easier for me to browse through them for motion instead of watching video), although IIRC compact lasted up to an hour. Solved it by using the Post (separate tab) JPEG option (post to a folder) instead of JPEG...