Stored procedures

Application environment: In general

TiDB version: Future

Reproduction method: New feature

Problem: New feature

Resource allocation: N/A

Attachment: N/A

My understanding is that TiDB doesn’t support stored procedures. That’s understandable since most dev teams today prefer keeping the business logic in the application code instead of in the database.

For existing applications which use hundreds of stored procedures, what’s a good option to migrate to use TiDB? Converting all stored procs to code requires too much work and it’s not an option.

Just brainstorm, is it possible to introduce a MySQL virtual machine in the TiDB product stack which just holds the stored procedures? This virtual machine is only accessed by the TiDB component. If a request coming in calls a stored proc, TiDB component accesses this virtual machine and parses the stored proc. All individual SQL statements or even transactions inside the stored proc would be handled just as if those statements and transactions come directly from the application from that point, right?

That would provide a lot of convenience for clients who heavily use stored procedures and want to migrate to TiDB.