ql
ql copied to clipboard
Do you have plans to support expirable rows (rows with TTL)?
I couldn't find such info in your godoc.
Some data are transient by nature, it would be nice for ql to support rows with TTL.
Is there an example of some other SQL supporting this?
Anyway, purging "dead" records from a table should be a simple DELETE ... WHERE ... statement, IIUC.
The most popular use-case is Cassandra's USING TTL example: https://docs.datastax.com/en/cql/3.3/cql/cql_using/useExpireExample.html
INSERT INTO cycling.calendar (race_id, race_name, race_start_date, race_end_date) VALUES (200, 'placeholder', '2015-05-27', '2015-05-27') USING TTL 86400;
And yes, you are correct, it's possible to have a deleted_at column and have a sweeper that go through every matching row. It's just nicer if it's supported at db level :)
Well, that's CQL. I now looked at SQL databases and I cannot find one supporting TTL.
Anyway, I see the value of this feature in certain scenarios. Some notes:
- Adding a new
USINGkeyword. Used by other SQL dialects, so not much of a concern. - Adding a new
TTLkeyword. This I would consider a backward incompatible change. With thevgoproposal now accepted, it can be solved, though. Alternatively, I think we can get away with not makingTTLa keyword. - Using the
USING TTLclause implies a R/W transaction must be used. That's a bit surprising when running aSELECTstatement. - I can provide help/support/guidance to someone implementing it, but waiting for me to implement the feature may take forever.
- Someone has to think out where the
TTLdata will be stored. I would go for a mandatory columnTTLof type time, containing the "dead after" time. That would probably be the simplest way how to implement the feature.
WDYT?
@didip Gentle ping.