Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Running pragma optimize on all connections #984

Open
YairHalberstadt opened this issue Nov 11, 2021 · 1 comment
Open

Running pragma optimize on all connections #984

YairHalberstadt opened this issue Nov 11, 2021 · 1 comment

Comments

@YairHalberstadt
Copy link

YairHalberstadt commented Nov 11, 2021

https://www.sqlite.org/lang_analyze.html recommends running

PRAGMA analysis_limit=400;
PRAGMA optimize;

on each DB Connection just before it closes.

However as #255 points out, there is no way to do access all connections at the moment.

It's important that this be run on every connection, since each connection stores data about which tables need to be analyzed base on queries it ran.

I wonder if we could expose some API to do this?

Thanks!

@rittneje
Copy link
Collaborator

Perhaps we could add a CloseHook, analogous to the existing ConnectHook. That would be very flexible and would allow you to perform any such pre-close actions, log, etc. whenever an individual connection in the pool is closed.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants