SQLite Forum

Runtime of and opcode counts of ANALYZE
Login
Please forgive me for essentially reiterating what larrybr said, but if your function does anything *at*all* I would also recommend his approach of incrementally adding in functionality. 

It sounds like you are saying that it is very simple, which is great as that process should be pretty quick. 

You've said that setting the handler to NULL makes the runtime much faster, and that your handler does have some functionality (it is doing something to increment the counter). 

What happens if you register a minimal handler that literally has no body (i.e. all it does is `return 0;` - no variable declarations or actions of any kind)?

If you do that test and it is still slow, that would provide good evidence that we should start looking in SQLite itself. If not, it would be helpful to have you share the minimal handler body that reproduces the problem.