You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
box.sql.execute("create table t1(id int primary key, a int, b int, c int)")
box.sql.execute("create index i2 on t1(b)")
box.sql.execute("create index i3 on t1(c)")
for i=1,1000000 do
box.space.T1:insert({i,10*i,i+1,i+100})
end
unix/:/var/run/tarantool/tarantool.sock> test = function(str)
> local start = clock.monotonic()
> a = box.sql.execute(str)
> return clock.monotonic() - start
> end
test("select a,b,c from t1 where a > 10000 or b < 100 or c > 1000000")
---
- 0.29623069998343
...
box.sql.execute("explain query plan select a,b,c from t1 where a > 10000 or b < 100 or c > 1000000")
---
- - [0, 0, 0, 'SCAN TABLE T1']
...
box.sql.execute("create index i4 on t1(a)")
---
...
test("select a,b,c from t1 where a > 10000 or b < 100 or c > 1000000")
---
- 1.487278399989
...
box.sql.execute("explain query plan select a,b,c from t1 where a > 10000 or b < 100 or c > 1000000")
---
- - [0, 0, 0, 'SEARCH TABLE T1 USING COVERING INDEX I4 (A>?)']
- [0, 0, 0, 'SEARCH TABLE T1 USING COVERING INDEX I2 (B<?)']
- [0, 0, 0, 'SEARCH TABLE T1 USING COVERING INDEX I3 (C>?)']
...
Execution with all covering indexes lasts ~3 times more than using fullscan
The text was updated successfully, but these errors were encountered:
Execution with all covering indexes lasts ~3 times more than using fullscan
The text was updated successfully, but these errors were encountered: