electric
electric copied to clipboard
Prepared statements in wa-sqlite are not cached
https://github.com/electric-sql/electric/blob/d385d3cf7eb4c8822afefdd6173fad7feb71712a/clients/typescript/src/drivers/wa-sqlite/database.ts#L45
prepare_v2
generates a new query plan every time it's called. Consider keeping a cache of prepared statements.
Amusingly I've been looking a little into this this afternoon. 🤣
Compiled prepared statements include a query plan, and so we probably want to clear any cache whenever migrations are applied.
@samwillis sqlite invalidates the query plan in prepared statements when the schema changes. The query plan will be regenerated when you will try to execute a query(calling sqlite_step). No special handling is required.
👋 we've been working the last month on a rebuild of the Electric server over at a temporary repo https://github.com/electric-sql/electric-next/
You can read more about why we made the decision at https://next.electric-sql.com/about
We're really excited about all the new possibilities the new server brings and we hope you'll check it out soon and give us your feedback.
We're now moving the temporary repo back here. As part of that migration we're closing all the old issues and PRs. We really appreciate you taking the time to investigate and report this issue!