Giter VIP home page Giter VIP logo

Comments (7)

brandond avatar brandond commented on June 10, 2024 2

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.

from kine.

wenerme avatar wenerme commented on June 10, 2024

seems this query cause the problem

listSQL = fmt.Sprintf(`
SELECT (%s), (%s), %s
FROM kine AS kv
JOIN (
SELECT MAX(mkv.id) AS id
FROM kine AS mkv
WHERE
mkv.name LIKE ?
%%s
GROUP BY mkv.name) maxkv
ON maxkv.id = kv.id
WHERE
(kv.deleted = 0 OR ?)
ORDER BY kv.id ASC
`, revSQL, compactRevSQL, columns)

subquery first, then agg

from kine.

brandond avatar brandond commented on June 10, 2024

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?

from kine.

wenerme avatar wenerme commented on June 10, 2024
PostgreSQL 13.1 on x86_64-pc-linux-musl, compiled by gcc (Alpine 9.3.0) 9.3.0, 64-bit

I use aliyun rds pg before, found the performance problem, then migrate to self host pg 13.

from kine.

wenerme avatar wenerme commented on June 10, 2024

@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.

from kine.

wenerme avatar wenerme commented on June 10, 2024

This is another cluster using aliyun rds pg, a lot slow query

image

from kine.

jgreat avatar jgreat commented on June 10, 2024

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?

from kine.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.