There would not be performance impact there. Your only limitation will be disk space.
Note this is actually used for things like incremental backups and point in time restore. It's pretty well tested and used.
I got a SaaS product and the data is kinda sensitive. I want to give my customers 100% security on the fact that I can't read their data.
If it's software as a service, and you do more than simply store blobs of data then give those blobs back when the customer asks, this is pretty much impossible.
You're dreaming. You can't realistically combine SaaS and the inability to see the customers' data.
(About the only outfit I know that does so is SpiderOak, and it does so by supporting almost no features - it stores stuff, and then it retrieves that stuff. That's it.)
Is this even possible? What kind of possibilities do I got?
Few.
You can't index encrypted data unless you know the key - and the index will contain decrypted values.
You can't write a WHERE
clause that filters based on the encrypted values unless you know the key. You could get the client to supply a pre-encrypted key to compare if it's a simple equality test, but you can't do b-tree index scans (requires >
and <
operators), or much else of interest.
You can't aggregate values unless you know the key.
You really can't do anything useful with them unless you know the key.
In theory you can use homomorphic encryption to allow computations on encrypted values. In practice it's incredibly limited, slow, and impractical, as well as weaker than other crypto. In practice most real-world homomorphic systems are useful for sums and that's about it.
Best Answer
pg_stat_reset will not affect query plans (it resets monitoring, not data-distribution, statistics), but it will cause autovacuum to think that no tables have recently been vacuumed, and so autovacuum activity will be elevated for a while. Whether this is a problem depends on the specifics of your data and how it's used.
This is a good article explaining the difference between the statistics used by the planner vs those that pg_stat_reset() affects, as well as how pg_stat_reset interacts with autovacuum:
https://blog.pgaddict.com/posts/the-two-kinds-of-stats-in-postgresql
I'd like to suggest an alternative, however: Just run
CREATE TABLE statistics_snapshot_TODAYS_YYYYMMDD AS SELECT * FROM pg_stat_user_indexes
(replacepg_stat_user_indexes
with whatever you're using if you are using a differentpg_stat_*
view), and then, in a week, do join it with the view and do a subtraction. This will give you week-over-week deltas, without having to reset anything.Sketch of the reporting query (not tested, but hopefully you get the idea):