Open narc-Ontakac2 opened 4 years ago
@narc-Ontakac2 Can you give me a use case you'd like to see? The ask we typically get are foreign keys into other tables, which probably aren't useful in the scenario you ask.
Additionally, space partitioning even makes the above difficult as well -- "UNIQUE with the latest chunk's time interval" /might/ be more possible, but this gets hard again once one introduces space partitioning (which is pretty important for distributed hypertables in multi-node TimescaleDB).
The use case is that I have rapid changing dimensions (http query strings, values and relations). I am currently filtering the INSERTs with WHERE NOT EXISTS to achieve uniqueness for a while. The goal is space reduction. These INSERTs would be faster if the temporary uniqueness would be achieved by a ON CONFLICT DO NOTHING.
This might be possible by defining operators for a clever EXCLUDE constraint. The problem is index usage. If I succeed I'll report here.
The issue of not beeing able to create a unique index on a hypertable frequently shows up, see #536. I am aware that this is not possible since it beats the purpose of the time partitioning, which is to keep index sizes "small".
A constraint that says "unique for 6 hours" should however be doable with postgres EXCLUE CONSTRAINTs,