-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
fix: Count does not work with MasterKey on Postgres #9220
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
Changes from all commits
c65278c
1b1da89
976a4ea
2e91df5
0cf57da
5876999
f913b32
bdbff07
b62f7e7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2048,9 +2048,9 @@ | |
if (where.pattern.length > 0 || !estimate) { | ||
qs = `SELECT count(*) FROM $1:name ${wherePattern}`; | ||
} else { | ||
await this.updateEstimatedCount(className); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I remember correctly, this else statement usually gets hit by the ParseDashboard and maybe the use of the masterKey. Since the dashboard heavily relies on count, do you anticipate a noticeable performance hit whenever a database manager (or multiple managers) are logged into the Dashboard? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The dashboard relies heavily on count on the initial browser load. I've never personally used ANALYZE on a large dataset before so I'm not sure of the performance. For the dashboard, I think we can add some documentation to recommend users to enable |
||
qs = 'SELECT reltuples AS approximate_row_count FROM pg_class WHERE relname = $1'; | ||
} | ||
|
||
return this._client | ||
.one(qs, values, a => { | ||
if (a.approximate_row_count == null || a.approximate_row_count == -1) { | ||
|
@@ -2425,9 +2425,9 @@ | |
return Promise.resolve(); | ||
} | ||
|
||
// Used for testing purposes | ||
async updateEstimatedCount(className: string) { | ||
return this._client.none('ANALYZE $1:name', [className]); | ||
return this._client.none('ANALYZE $1:name', [className]) | ||
.catch((e) => console.error(`Error: Failed to ANALYZE ${className}:`, e)); | ||
} | ||
|
||
async createTransactionalSession(): Promise<any> { | ||
|
Uh oh!
There was an error while loading. Please reload this page.