zenstack icon indicating copy to clipboard operation
zenstack copied to clipboard

[Feature Request] View query details in VSCode (DX)

Open sidharthv96 opened this issue 1 year ago • 0 comments

Is your feature request related to a problem? Please describe. After analysing some runtime performance issues, we're able to easily tweak the queries or access rules to get significantly smaller queries. But, the DX requires running the REPL, in editor mode, and it could be improved significantly. With the newly introduced check function, a developer might not fully understand the complexity of the underlying query, so it's easy to get complex prisma queries based on simple queries in code.

Describe the solution you'd like If we expose the generated prisma query for each zenstack query into Language Server, and display the actual query on hover (or some other way), then the developers can easily understand the actual complexity. If we can map the query into a "complexity score", based on tables queried, number of joins, indexes that are part of the join, etc, it'll be a much better DX.

Describe alternatives you've considered

  • Using prisma debug mode to view SQL commands run
  • Using REPL to get prisma query from zenstack query

Additional context This is purely a DX focused feature.

We had a simple db.<model>.count() query that was internally querying multiple tables, doing multiple joins on same table, etc. Which was caught after digging into our traces. If we have some indication of complexity during development, that would help a lot.

sidharthv96 avatar Jul 22 '24 10:07 sidharthv96