github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/sql/opt/exec/execbuilder/testdata/partial_index (about)

     1  # LogicTest: local
     2  
     3  # TODO(mgartner): remove this once partial indexes are fully supported.
     4  statement ok
     5  SET experimental_partial_indexes=on
     6  
     7  statement ok
     8  CREATE TABLE t (
     9      a INT PRIMARY KEY,
    10      b INT,
    11      c STRING,
    12      FAMILY (a, b, c),
    13      INDEX (b) WHERE b > 10,
    14      INDEX (c) WHERE a > b AND c = 'foo'
    15  )
    16  
    17  # Inserted row matches no partial index.
    18  query T kvtrace
    19  INSERT INTO t VALUES(5, 4, 'bar')
    20  ----
    21  CPut /Table/53/1/5/0 -> /TUPLE/2:2:Int/4/1:3:Bytes/bar
    22  
    23  # Inserted row matches the first partial index.
    24  query T kvtrace
    25  INSERT INTO t VALUES(6, 11, 'bar')
    26  ----
    27  CPut /Table/53/1/6/0 -> /TUPLE/2:2:Int/11/1:3:Bytes/bar
    28  InitPut /Table/53/2/11/6/0 -> /BYTES/
    29  
    30  # Inserted row matches both partial indexes.
    31  query T kvtrace
    32  INSERT INTO t VALUES(12, 11, 'foo')
    33  ----
    34  CPut /Table/53/1/12/0 -> /TUPLE/2:2:Int/11/1:3:Bytes/foo
    35  InitPut /Table/53/2/11/12/0 -> /BYTES/
    36  InitPut /Table/53/3/"foo"/12/0 -> /BYTES/