Comments (6)
Can you explain what this means? Are you suggesting a feature where rows can be written with a TTL and they auto-delete? If so, this is firmly in the realm of MySQL would need to support this and outside of the scope of our driver. But in general there are lots of established patterns for doing this in relational databases, I'm just curious what you have in mind and maybe we can guide you to a solution.
from database-js.
Oh wow, I'm assuming you mean https://dev.mysql.com/doc/refman/8.0/en/create-event.html
I wasn't even aware of this being a thing. I haven't poked around, but I suspect then that this is lack of support in Vitess that we'd need.
from database-js.
Hey there! I was reading the MySQL documentation on this and you're right, this is something that we do not support. If a record is subject to a TTL, I'd suggest handling this at the application level. A pattern for doing this is to set a timestamp based on TTL on each row and having a scheduled job that runs a set interval of time to do what you need. This is a pattern that we use internally at PlanetScale for this type of thing and it works really well for us. I hope this helps out!
If that doesn't fit your use-case, I suggest opening an issue in the Vitess repository, where this is the root of the issue. Thanks!
from database-js.
Extending on iheanyi you don't even have to remove those "TTL" columns on time, I do the same for sessions and the query just checks that the TTL is in the future and hasn't expired yet
from database-js.
@CanRau but then the database fills up with data you won't need
@iheanyi it was clear to me how to do this manually. the point is that it's still some significant effort and you need a dedicated process vs setting some ttl (as with most other dbs) and call it a day
Also not sure if Vitess and/or PS can support this b/c this would require a long-running process
from database-js.
Yea I see, my comment was meant like, the cron or whatever doesn't need to run as exact/often to ensure expired rows are deleted on time, it can "just" run every hour or whatever and remove everything already expired.
But yea this requires some additional code/system.
Just saw that EVENT
is basically a cron like scheduler.
Currently Vitess doesn't support stored procedures at all afaik, and this looks similar.
I accept some of those missing pieces for the benefits of the platform and personally need cron like stuff anyway, which I can then use to clean up old db stuff as well.
from database-js.
Related Issues (20)
- Strongly type "type" property of Field
- Type error fetch failed HOT 10
- Automatically handle seeing a port 3306 in a connection string HOT 4
- INVISIBLE columns showing up with SELECT * HOT 6
- feat: Support syntax helper for "bulk insert with parameters"
- Malformed interface Field HOT 1
- [Feature] A type can be defined for `rows` in the query result HOT 6
- json_object converts bigints to numbers HOT 2
- Weird error with FKC HOT 5
- Error: direct DDL is disabled. Shadow Databases not helping, Development Branches not helping HOT 4
- New tables not found in foreign key enabled cluster HOT 2
- bug: `BLOB` / `Buffer` input parameters result in corrupted data
- Simple `show tables` statement not cast correctly by default HOT 11
- UUIDs Get Returned Incorrectly HOT 2
- CF Hyperdrive support? HOT 5
- Bug with JSON columns on >=1.15.0 HOT 12
- Customising cast results in unexpected behaviour HOT 2
- Numbers returned as strings HOT 15
- CI for tagging and pushing releases
- VT12001: unsupported: subqueries in DML when using delete() with where that filters on relation field HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from database-js.