influxdata / influxdata/influxdb

LIMIT 0 returns all the results instead of none

Open
#14,306 8 comments 0 reactions 0 assignees View on GitHub
1.x
Dominant language
Rust
Stars
31.7k
Forks
3.7k
Avg merge
13h 37m
Merged PRs (30d)
8

Description

InfluxDB ignores the LIMIT clause when it is `LIMIT 0`. This behavior is not documented, and surprising. A client that dynamically computes the LIMIT of a query could end up running a very expensive query because of this.

__Steps to reproduce:__
List the minimal actions needed to reproduce the behavior.

1. Create a measurement `test` with 10 points
2. launch the following query: `SELECT * FROM test LIMIT 0`

__Expected behavior:__
Returns an empty result set

__Actual behavior:__
Returns all the points from the series.

__Environment info:__

* InfluxDB version: InfluxDB vv1.7.6 (git: master 01c8dd416270f424ab0c40f9291e269ac6921964)

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue by creating a measurement with 10 points and running `SELECT * FROM test LIMIT 0`. Trace the query's LIMIT handling and add a regression test; done means the query returns an empty result set instead of all points.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.