-
Notifications
You must be signed in to change notification settings - Fork 316
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
Performance Issue: Slow Query Execution Despite Using LIMIT
#3274
Comments
Hi @fredrikIOT, appreciate your detailed feedback! I noticed you also run |
@fredrikIOT Can you share the SQL of creating table "location1"? |
@waynexia I need to correct an error in my previous message. I referenced the wrong query and result. Here's the accurate information: While reviewing this, I've noticed the significant impact of the
So, I guess the question of whether |
@MichaelScofield Here's the SQL for creating the "location1" table: CREATE TABLE IF NOT EXISTS "location1" (
"location_uid" STRING NULL,
"room_uid" STRING NULL,
"log_uid" STRING NULL,
"sensor_name" STRING NULL,
"value" DOUBLE NULL,
"ts" TIMESTAMP(3) NOT NULL,
TIME INDEX ("ts"),
PRIMARY KEY ("location_uid", "room_uid", "log_uid", "sensor_name")
) ENGINE=mito WITH(regions = 1) As I mentioned in my previous message, the performance issue seems to be primarily due to the |
Yes, that's correct. The main reason that We can keep this issue open as a tracker. |
I'm afraid that I don't have enough time to finish it in v0.8, maybe I can optimize some cases in v0.9. |
We implemented some optimize rules and execution plans for this case.
v0.10.0 will include these changes. Now |
What type of bug is this?
Performance issue
What subsystems are affected?
Standalone mode
Minimal reproduce step
SELECT * FROM "location1" ORDER BY ts DESC LIMIT 100;
.What did you expect to see?
Expected efficient use of
LIMIT
andOFFSET
, where the query execution should be quick, only processing the first 100 rows.What did you see instead?
The query execution is slow, taking multiple seconds (8634 ms) despite using
LIMIT
. It seems that theLIMIT
clause does not stop the query processing after reaching the limit but only restricts the number of rows returned.Performance Metrics:
SELECT * FROM "location1" ORDER BY ts DESC LIMIT 100;
. Metrics:SELECT count(*) FROM "location1";
:SQL Analyze:
Result:
What operating system did you use?
Docker (Ubuntu)
What version of GreptimeDB did you use?
docker image: greptime/greptimedb:nightly-20240126-8bade8f8e4
Relevant log output and stack trace
No response
The text was updated successfully, but these errors were encountered: