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

feat: adds .explain() for debugging performance issues on Supabase client generated queries. #719

Merged
merged 10 commits into from Nov 21, 2023

Conversation

dshukertjr
Copy link
Member

@dshukertjr dshukertjr commented Nov 21, 2023

What kind of change does this PR introduce?

Adds a new .explain() transformer that will return

final String plan = await supabase.from('table').select().explain(); 

// `plan` will be something like this as plain String:
// Aggregate  (cost=8.18..8.20 rows=1 width=112)
//  ->  Index Scan using projects_pkey on projects  (cost=0.15..8.17 rows=1 width=40)
//        Index Cond: (id = 1)

The JS SDK has a json and text response types, but text is preferred, so I think it's okay to only have text for Dart SDK.

JS implementation here https://github.com/supabase/postgrest-js/blob/master/src/PostgrestTransformBuilder.ts#L245

Closes #717

@dshukertjr dshukertjr marked this pull request as draft November 21, 2023 05:39
@dshukertjr dshukertjr marked this pull request as ready for review November 21, 2023 08:45
@dshukertjr dshukertjr merged commit f6e4157 into next Nov 21, 2023
8 checks passed
@dshukertjr dshukertjr deleted the feat/explain branch November 21, 2023 09:07
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 this pull request may close these issues.

None yet

2 participants