@@ -456,8 +456,8 @@ Index Scan using Index test_b_idx_btree (test.b) on test
456
456
"select * from test where b = 2 and a = 1" ,
457
457
expect ! [
458
458
r#"
459
- Index Scan using Index test_a_b_idx_btree (test.b , test.a ) on test
460
- Index Cond: (test.b = U64(2 ), test.a = U64(1 ))
459
+ Index Scan using Index test_a_b_idx_btree (test.a , test.b ) on test
460
+ Index Cond: (test.a = U64(1 ), test.b = U64(2 ))
461
461
Output: test.a, test.b, test.c, test.d"#
462
462
] ,
463
463
) ;
@@ -513,15 +513,14 @@ Seq Scan on test
513
513
db. create_table_for_test ( "test" , schema, indexes) ?;
514
514
515
515
let tx = begin_tx ( & db) ;
516
- // TODO: Need support for index range scans.
517
516
expect_query (
518
517
& tx,
519
518
"select * from test where b > 2" ,
520
519
expect ! [
521
520
r#"
522
- Seq Scan on test
523
- Output: test.a, test.b
524
- -> Filter: ( test.b > U64(2)) "#
521
+ Index Scan using Index test_b_idx_btree (test.b) on test
522
+ Index Cond: ( test.b > U64(2))
523
+ Output: test.a, test.b "#
525
524
] ,
526
525
) ;
527
526
@@ -538,15 +537,15 @@ Seq Scan on test
538
537
db. create_table_for_test ( "test" , schema, indexes) ?;
539
538
540
539
let tx = begin_tx ( & db) ;
541
- //TODO(sql): Need support for index scans for ranges
542
540
expect_query (
543
541
& tx,
544
542
"select * from test where b > 2 and b < 5" ,
545
543
expect ! [
546
544
r#"
547
- Seq Scan on test
545
+ Index Scan using Index test_b_idx_btree (test.b) on test
546
+ Index Cond: (test.b > U64(2))
548
547
Output: test.a, test.b
549
- -> Filter: (test.b > U64(2) AND test.b < U64(5))"#
548
+ -> Filter: (test.b < U64(5))"#
550
549
] ,
551
550
) ;
552
551
@@ -563,17 +562,20 @@ Seq Scan on test
563
562
db. create_table_for_test ( "test" , schema, indexes) ?;
564
563
565
564
let tx = begin_tx ( & db) ;
566
- // Note, order matters - the equality condition occurs first which
567
- // means an index scan will be generated rather than the range condition.
568
565
expect_query (
569
566
& tx,
570
- "select * from test where a = 3 and b > 2 and b < 5" ,
567
+ "select * from test where b > 2 and b < 5 and a = 3 " ,
571
568
expect ! [
572
569
r#"
573
- Index Scan using Index test_a_idx_btree (test.a) on test
574
- Index Cond: (test.a = U64(3))
570
+ Union
571
+ -> Index Scan using Index test_a_idx_btree (test.a) on test
572
+ Index Cond: (test.a = U64(3))
573
+ Output: test.a, test.b
574
+ -> Index Scan using Index test_b_idx_btree (test.b) on test
575
+ Index Cond: (test.b > U64(2))
576
+ Output: test.a, test.b
575
577
Output: test.a, test.b
576
- -> Filter: (test.b < U64(5) AND test.b > U64(2) )"#
578
+ -> Filter: (test.b < U64(5))"#
577
579
] ,
578
580
) ;
579
581
@@ -717,9 +719,9 @@ Hash Join: Lhs
717
719
Index Cond: (lhs.a = U64(3))
718
720
Output: lhs.a, lhs.b
719
721
-> Hash Build: rhs.b
720
- -> Seq Scan on rhs
721
- Output: rhs.b, rhs.c
722
- -> Filter: ( rhs.c < U64(4)) "#
722
+ -> Index Scan using Index rhs_c_idx_btree (rhs.c) on rhs
723
+ Index Cond: ( rhs.c < U64(4))
724
+ Output: rhs.b, rhs.c "#
723
725
] ,
724
726
) ;
725
727
@@ -756,9 +758,10 @@ Index Join: Rhs on lhs
756
758
Inner Unique: false
757
759
Join Cond: (rhs.b = lhs.b)
758
760
Output: lhs.a, lhs.b
759
- -> Seq Scan on rhs
761
+ -> Index Scan using Index rhs_c_idx_btree (rhs.c) on rhs
762
+ Index Cond: (rhs.c > U64(2))
760
763
Output: rhs.b, rhs.c, rhs.d
761
- -> Filter: (rhs.c > U64(2) AND rhs.c < U64(4) AND rhs.d = U64(3))"#
764
+ -> Filter: (rhs.c < U64(4) AND rhs.d = U64(3))"#
762
765
] ,
763
766
) ;
764
767
@@ -795,8 +798,8 @@ Index Join: Rhs on lhs
795
798
Inner Unique: false
796
799
Join Cond: (rhs.b = lhs.b)
797
800
Output: lhs.a, lhs.b
798
- -> Index Scan using Index rhs_b_c_idx_btree (rhs.c , rhs.b ) on rhs
799
- Index Cond: (rhs.c = U64(2 ), rhs.b = U64(4 ))
801
+ -> Index Scan using Index rhs_b_c_idx_btree (rhs.b , rhs.c ) on rhs
802
+ Index Cond: (rhs.b = U64(4 ), rhs.c = U64(2 ))
800
803
Output: rhs.b, rhs.c, rhs.d
801
804
-> Filter: (rhs.d = U64(3))"#
802
805
] ,
0 commit comments