Skip to content

Support "EXPLAIN QUERY PLAN" #76

New issue

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

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

Already on GitHub? Sign in to your account

Closed
LostKobrakai opened this issue Jun 20, 2022 · 2 comments · Fixed by #77
Closed

Support "EXPLAIN QUERY PLAN" #76

LostKobrakai opened this issue Jun 20, 2022 · 2 comments · Fixed by #77

Comments

@LostKobrakai
Copy link
Contributor

LostKobrakai commented Jun 20, 2022

In sqlite EXPLAIN QUERY PLAN … and EXPLAIN … return different values. Currently only the latter is supported with Repo.explain(:all, query), but I'd expect that the first one is actually the more common need, why people reach for explain. I think both options should be available (as enabled via the opts), but I think EXPLAIN QUERY PLAN should be the default, rather than just EXPLAIN.

@LostKobrakai
Copy link
Contributor Author

It would also be great if aliases and parameters could be replaced in the result. I'm not sure how involved this is though.

@warmwaffles
Copy link
Member

It's a pretty quick add

def build_explain_query(query) do
IO.iodata_to_binary(["EXPLAIN ", query])
end

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

Successfully merging a pull request may close this issue.

2 participants