Skip to content
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

Add ability to get execution plan for embedded SQL #297

Closed
isc-lindensc opened this issue Nov 7, 2023 · 9 comments
Closed

Add ability to get execution plan for embedded SQL #297

isc-lindensc opened this issue Nov 7, 2023 · 9 comments

Comments

@isc-lindensc
Copy link

Hi,
we have the language server that helps a lot with formatting and other issue during coding.

There is another code formatting/linting solution currently available codeTidy.

This does more or less the same as the language server, but expands it in some areas e.g. it can add SQL execution plans on save/compile, force commenting style (e.g. replace // with #; etc)

For this to work though codetidy needs to be installed into a namespace and sourcecontrol hooks need to be enabled for the namespace.

Could we look into moving the functionality of codetidy into the language server?

Best Regards
Timo

@gjsjohnmurray
Copy link
Collaborator

A disadvantage I see of this approach is that it's likely to hamper the chances of community contribution to its improvement. Currently it is written in ObjectScript and has a public GitHub repo. It's also published on Open Exchange and installable using ZPM.

Moving it into the language server might mean reimplementation in TypeScript of even C. Plus, only part of the LS source is public.

I'd prefer the effort to go into bringing IPM "over the line" so every IRIS instance has it built in.

@isc-bsaviano
Copy link
Contributor

@isc-lindensc There's no way to integrate codetidy to with this extension since it's a server-side technology. I'm not that familiar with its features. Can you list the ones you'd like to see implemented in the Language Server's formatter? I can comment on the feasibility of each.

@isc-bsaviano
Copy link
Contributor

@isc-lindensc I looked at CodeTidy's config options and I didn't see any features I would consider "must-add". Indentation is covered by #293. Converting comments to macro versions isn't terribly difficult, but I wouldn't classify that as high-value. Which specific features do you want to see implemented here?

@isc-lindensc
Copy link
Author

isc-lindensc commented Nov 10, 2023 via email

@isc-bsaviano
Copy link
Contributor

@isc-lindensc Thanks for clarifying. I can see the value of having that information, but I don't think it should be part of the formatter. The goal of formatting is make code more readable and reduce style-based source control diffs. I think adding a big block of XML to your document goes against these principles.

@isc-bsaviano isc-bsaviano changed the title codetidy Add ability to get execution plan for embedded SQL Nov 10, 2023
@bdeboe
Copy link

bdeboe commented Nov 13, 2023

Hi @isc-lindensc ,

I'm not sure this is a practical place to show the query plan. Query plans are meant to adapt to the actual data distribution (aka Tune Table stats) in the environment where you're running the statement, and to the supplied runtime parameter values in case they'd warrant a separate query plan (aka Run Time Plan Choice). That context is not available as part of the "code" the language server sees. Unless you have completely disabled those features (no hard feelings, but the team worked hard to make them a reality ;-) ) and use /compileembedded, you'd have to add a lot of disclaimers about this being a "probable" plan that's only based on what is statically available.

Given all of the above, I don't think it's a very practical extension, but I'm happy to hear more context so maybe we find a practical way to get you what you want.

thanks,
benjamin

@isc-lindensc
Copy link
Author

Hi @bdeboe ,

this extension is based on code used by TC development internally. Its very useful.

Usually what's happening is that either the tune table stats are exported from production and imported into a development environment or deployed code comes with stats predesigned.
It allows the developer to see during development if a sql query designed badly , e.g. doing table scans and not using an index.

But yes agreed developers need to understand that the plan is based on existing statistics.

regards
Timo

@bdeboe
Copy link

bdeboe commented Nov 23, 2023

Hi @isc-lindensc ,

Thanks for the additional context. I can see how this is useful, but the need for proper disclaimers remains. Would something crude in the form of an assist link (similar to "Debug" and "Copy invocation" for methods) that just show the output of EXPLAIN in the new WebTerminal be helpful? That may not be a lot of work and still get you the important feedback, whereas any actual rendering of the query plan or something inline would require a lot more dev effort. This may not be a language server question anymore though.

Thanks,
benjamin

@isc-bsaviano
Copy link
Contributor

Given the number and severity of the disclaimers pointed out by Ben, I don't think this feature is worth adding.

@isc-bsaviano isc-bsaviano closed this as not planned Won't fix, can't repro, duplicate, stale Nov 27, 2023
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

No branches or pull requests

4 participants