github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/sql/opt/idxconstraint/testdata/multi-column (about)

     1  index-constraints vars=(int, int) index=(@1)
     2  @1 = 1 AND @2 = 2
     3  ----
     4  [/1 - /1]
     5  Remaining filter: @2 = 2
     6  
     7  index-constraints vars=(int, int) index=(@2)
     8  @1 = 1 AND @2 = 2
     9  ----
    10  [/2 - /2]
    11  Remaining filter: @1 = 1
    12  
    13  index-constraints vars=(int, int) index=(@1, @2)
    14  @1 = 1 AND @2 > NULL
    15  ----
    16  
    17  index-constraints vars=(int, int) index=(@1, @2)
    18  @2 = 1 AND @1 > NULL
    19  ----
    20  
    21  index-constraints vars=(int) index=(@1)
    22  @1 > 2 AND @1 < 4
    23  ----
    24  [/3 - /3]
    25  
    26  index-constraints vars=(int) index=(@1)
    27  @1 >= 2 AND @1 <= 4
    28  ----
    29  [/2 - /4]
    30  
    31  index-constraints vars=(int, int) index=(@1, @2)
    32  @1 > 2 AND @2 > 5
    33  ----
    34  [/3/6 - ]
    35  Remaining filter: @2 > 5
    36  
    37  index-constraints vars=(int, int) index=(@1, @2 desc)
    38  @1 > 2 AND @2 < 5
    39  ----
    40  [/3/4 - ]
    41  Remaining filter: @2 < 5
    42  
    43  index-constraints vars=(int, int) index=(@1, @2)
    44  @1 != 1 AND @2 > 5
    45  ----
    46  (/NULL - /0]
    47  [/2/6 - ]
    48  Remaining filter: @2 > 5
    49  
    50  index-constraints vars=(int, int) index=(@1, @2)
    51  @1 != 1 AND @2 < 5
    52  ----
    53  (/NULL - /0/4]
    54  (/2/NULL - ]
    55  Remaining filter: @2 < 5
    56  
    57  index-constraints vars=(int) index=(@1)
    58  @1 >= 1 AND @1 <= 5 AND @1 != 3
    59  ----
    60  [/1 - /2]
    61  [/4 - /5]
    62  
    63  index-constraints vars=(int, int) index=(@1, @2)
    64  @1 >= 1 AND @1 <= 2 AND @2 >= 8 AND @2 <= 9
    65  ----
    66  [/1/8 - /2/9]
    67  Remaining filter: (@2 >= 8) AND (@2 <= 9)
    68  
    69  index-constraints vars=(int, int) index=(@1 desc, @2)
    70  @1 >= 1 AND @1 <= 2 AND @2 >= 8 AND @2 <= 9
    71  ----
    72  [/2/8 - /1/9]
    73  Remaining filter: (@2 >= 8) AND (@2 <= 9)
    74  
    75  index-constraints vars=(int, int) index=(@1, @2 desc)
    76  @1 >= 1 AND @1 <= 2 AND @2 >= 8 AND @2 <= 9
    77  ----
    78  [/1/9 - /2/8]
    79  Remaining filter: (@2 >= 8) AND (@2 <= 9)
    80  
    81  index-constraints vars=(int, int) index=(@1, @2)
    82  @1 > 1 AND @1 < 4 AND @2 > 5 AND @2 < 8
    83  ----
    84  [/2/6 - /3/7]
    85  Remaining filter: (@2 > 5) AND (@2 < 8)
    86  
    87  index-constraints vars=(int, int) index=(@1, @2)
    88  @1 > 1 AND @1 < 4 AND @2 = 5
    89  ----
    90  [/2/5 - /3/5]
    91  Remaining filter: @2 = 5
    92  
    93  index-constraints vars=(int, int) index=(@1, @2)
    94  @1 = 1 AND @2 > 3 AND @2 < 5
    95  ----
    96  [/1/4 - /1/4]
    97  
    98  index-constraints vars=(int, int) index=(@1, @2)
    99  @1 = 1 AND @2 > 3 AND @2 < 8
   100  ----
   101  [/1/4 - /1/7]
   102  
   103  index-constraints vars=(int) index=(@1)
   104  @1 > 2 AND @1 < 1
   105  ----
   106  
   107  index-constraints vars=(int, int) index=(@1, @2)
   108  @1 = 1 AND @2 != 2
   109  ----
   110  (/1/NULL - /1/1]
   111  [/1/3 - /1]
   112  
   113  index-constraints vars=(int, int) index=(@1, @2)
   114  (@1 = 0 AND @2 = 0) OR (@1 = 10 AND @2 = 10)
   115  ----
   116  [/0/0 - /0/0]
   117  [/10/10 - /10/10]
   118  
   119  # Note: columns 2 and 3 are not null so that (@2, @3) <= (15, 25) generates a
   120  # tight span.
   121  index-constraints vars=(int, int, int) index=(@1, @2 not null, @3 not null)
   122  (@1 = 1) OR (@1 = 2 AND (@2, @3) >= (10, 20) AND (@2, @3) <= (15, 25))
   123  ----
   124  [/1 - /1]
   125  [/2/10/20 - /2/15/25]
   126  
   127  index-constraints vars=(int, int) index=(@1, @2)
   128  @1 >= 1 AND @1 <= 5 AND @2 != 2
   129  ----
   130  (/1/NULL - /5]
   131  Remaining filter: @2 != 2
   132  
   133  index-constraints vars=(int, int, int) index=(@1, @2, @3)
   134  @1 = 1 AND (@3 > 0 OR @3 < 10)
   135  ----
   136  [/1 - /1]
   137  Remaining filter: (@3 > 0) OR (@3 < 10)
   138  
   139  index-constraints vars=(string, int) index=(@1, @2)
   140  (((@1,) > ('us-east1',)) AND ((@1,) < ('us-west1',))) OR ((((@1,) > ('europe-west2',)) AND ((@1,) < ('us-east1',))) OR (((@1,) > ('us-west1',)) OR ((@1,) < ('europe-west2',))))
   141  ----
   142  (/NULL - /'europe-west2')
   143  [/e'europe-west2\x00' - /'us-east1')
   144  [/e'us-east1\x00' - /'us-west1')
   145  [/e'us-west1\x00' - ]
   146  
   147  # The spans for @3 are applied after that for @2, so we lose information that
   148  # [/1/76/10 - /1/76/10] and [/3/76/5 - /3/76/5] are not possible.
   149  index-constraints vars=(int, int, int) index=(@1 not null, @2 not null, @3 not null)
   150  ((@1 = 1 AND @3 = 5) OR (@1 = 3 AND @3 = 10)) AND (@2 = 76)
   151  ----
   152  [/1/76/5 - /1/76/5]
   153  [/1/76/10 - /1/76/10]
   154  [/3/76/5 - /3/76/5]
   155  [/3/76/10 - /3/76/10]
   156  Remaining filter: ((@1 = 1) AND (@3 = 5)) OR ((@1 = 3) AND (@3 = 10))
   157  
   158  # Unlike the previous example, we can generate 2 column spans for the individual
   159  # ORed sub-expressions, so the spans are tight.
   160  index-constraints vars=(int, int, int) index=(@1 not null, @2 not null, @3 not null)
   161  ((@1 = 1 AND @2 = 5) OR (@1 = 3 AND @2 = 10)) AND (@3 = 76)
   162  ----
   163  [/1/5/76 - /1/5/76]
   164  [/3/10/76 - /3/10/76]