Let user write their own SQL queries and meter how much time they use for billing or abuse prevention.
Databases are huge security vulnerabilities and should always have some kind of shim over them. Never expose your relational DB publicly if you want any control over it.
Or (as is the fashion recently) compile sqlite to wasm and run it in browser.
Let user write their own SQL queries and meter how much time they use for billing or abuse prevention.