iPhone data overwrite

How long does it take iPhone 7 (iOS 12.2) to overwrite the data of recently deleted photos/videos?

Does it happen instantly right after I take another photo/video (the new photo replaces the deleted one’s data pointer, and the deleted one is now unrecoverable?), or does it take months?

Thank you!