-
Notifications
You must be signed in to change notification settings - Fork 245
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
PostgreSQL consider rewrite subquery to nested query with order by - 1000x+ performance improve #77
Comments
seems this query cause the problem kine/pkg/drivers/generic/generic.go Lines 43 to 57 in 31fbd94
subquery first, then agg |
Signed-off-by: wener <[email protected]>
What version of postgres did you test this on? I've noticed that newer versions perform much better; it's possible that the query optimizer in these versions handles the current query better. Also, I see that your PR changed the generic query - have you tested it on sqlite and MySQL as well? |
I use aliyun rds pg before, found the performance problem, then migrate to self host pg 13. |
@brandond not tested on sqlite and MySQL, but I expected to see same performance if the engine already handle the optimization on this situation. If the subquery not materialized, then the performance should better than before.I think this syntax is generic enough, should not cause any problem. |
I like the PR but I'm going to wait on adding some automated tests against a couple different DB engines and versions before I merge it. |
Signed-off-by: wener <[email protected]>
Signed-off-by: wener <[email protected]>
Signed-off-by: wener <[email protected]>
Signed-off-by: wener <[email protected]>
I'm seeing k3s server throwing a lot of "TRACE" messages for long transaction commit times when using Postgres as a backend. Could this issue be related? Any update on PR #78 to fix it? |
Signed-off-by: wener <[email protected]>
Address minor style nits Signed-off-by: Brad Davidson <[email protected]> Signed-off-by: 陈杨文 <[email protected]>
Address minor style nits Signed-off-by: Brad Davidson <[email protected]> Signed-off-by: 陈杨文 <[email protected]> Signed-off-by: waynelwz <[email protected]>
original
execute in 53s
by using nested - same result
execute in 4ms
full analyse https://explain.depesz.com/s/HUEf
The text was updated successfully, but these errors were encountered: