Skip to content

Commit

Permalink
Merge #51879
Browse files Browse the repository at this point in the history
51879: opt: don't create unnecessary FK indexes in testcat r=RaduBerinde a=RaduBerinde

We no longer create FK indexes on the referencing side; this commit
updates the test catalog accordingly.

We also adjust the tpcc schema to remove the indexes that we decided
are unnecessary and removed from our fixtures.

Release note: None

Co-authored-by: Radu Berinde <[email protected]>
  • Loading branch information
craig[bot] and RaduBerinde committed Jul 25, 2020
2 parents a16eb55 + dc66af2 commit 979f4ad
Show file tree
Hide file tree
Showing 13 changed files with 431 additions and 525 deletions.
65 changes: 30 additions & 35 deletions pkg/sql/opt/memo/testdata/logprops/join
Original file line number Diff line number Diff line change
Expand Up @@ -1789,13 +1789,13 @@ inner-join (hash)
├── key: (1)
├── fd: (1)-->(2-4), (6)-->(7-9), (8,9)~~>(6,7), (3)==(6), (6)==(3)
├── prune: (1,2,4,7-9)
├── interesting orderings: (+1) (+3,+1) (+4,+1) (+6) (-8,+9,+6)
├── interesting orderings: (+1) (+6) (-8,+9,+6)
├── scan fk
│ ├── columns: k:1(int!null) v:2(int) r1:3(int!null) r2:4(int)
│ ├── key: (1)
│ ├── fd: (1)-->(2-4)
│ ├── prune: (1-4)
│ ├── interesting orderings: (+1) (+3,+1) (+4,+1)
│ ├── interesting orderings: (+1)
│ └── unfiltered-cols: (1-5)
├── scan xysd
│ ├── columns: x:6(int!null) y:7(int) s:8(string) d:9(decimal!null)
Expand All @@ -1819,13 +1819,13 @@ inner-join (hash)
├── key: (1)
├── fd: (1)-->(2-4), (6)-->(7-9), (8,9)~~>(6,7), (4)==(6), (6)==(4)
├── prune: (1-3,7-9)
├── interesting orderings: (+1) (+3,+1) (+4,+1) (+6) (-8,+9,+6)
├── interesting orderings: (+1) (+6) (-8,+9,+6)
├── scan fk
│ ├── columns: k:1(int!null) v:2(int) r1:3(int!null) r2:4(int)
│ ├── key: (1)
│ ├── fd: (1)-->(2-4)
│ ├── prune: (1-4)
│ ├── interesting orderings: (+1) (+3,+1) (+4,+1)
│ ├── interesting orderings: (+1)
│ └── unfiltered-cols: (1-5)
├── scan xysd
│ ├── columns: x:6(int!null) y:7(int) s:8(string) d:9(decimal!null)
Expand All @@ -1850,13 +1850,13 @@ inner-join (cross)
├── key: (1,6)
├── fd: (1)-->(2-4), (6)-->(7-9), (8,9)~~>(6,7)
├── prune: (1-4,6-9)
├── interesting orderings: (+1) (+3,+1) (+4,+1) (+6) (-8,+9,+6)
├── interesting orderings: (+1) (+6) (-8,+9,+6)
├── scan fk
│ ├── columns: k:1(int!null) v:2(int) r1:3(int!null) r2:4(int)
│ ├── key: (1)
│ ├── fd: (1)-->(2-4)
│ ├── prune: (1-4)
│ ├── interesting orderings: (+1) (+3,+1) (+4,+1)
│ ├── interesting orderings: (+1)
│ └── unfiltered-cols: (1-5)
├── scan xysd
│ ├── columns: x:6(int!null) y:7(int) s:8(string) d:9(decimal!null)
Expand All @@ -1879,13 +1879,13 @@ inner-join (hash)
├── key: (1)
├── fd: (1)-->(2-4), (6)-->(7-9), (8,9)~~>(6,7), (3)==(6), (6)==(3)
├── prune: (1,2,4,7-9)
├── interesting orderings: (+1) (+3,+1) (+4,+1) (+6) (-8,+9,+6)
├── interesting orderings: (+1) (+6) (-8,+9,+6)
├── scan fk
│ ├── columns: k:1(int!null) v:2(int) r1:3(int!null) r2:4(int)
│ ├── key: (1)
│ ├── fd: (1)-->(2-4)
│ ├── prune: (1-4)
│ ├── interesting orderings: (+1) (+3,+1) (+4,+1)
│ ├── interesting orderings: (+1)
│ └── unfiltered-cols: (1-5)
├── scan xysd
│ ├── columns: x:6(int!null) y:7(int) s:8(string) d:9(decimal!null)
Expand All @@ -1912,13 +1912,13 @@ left-join (hash)
├── fd: (1)-->(2-4,6-9), (6)-->(7-9), (8,9)~~>(6,7)
├── prune: (1-3,7-9)
├── reject-nulls: (6-9)
├── interesting orderings: (+1) (+3,+1) (+4,+1) (+6) (-8,+9,+6)
├── interesting orderings: (+1) (+6) (-8,+9,+6)
├── scan fk
│ ├── columns: k:1(int!null) v:2(int) r1:3(int!null) r2:4(int)
│ ├── key: (1)
│ ├── fd: (1)-->(2-4)
│ ├── prune: (1-4)
│ ├── interesting orderings: (+1) (+3,+1) (+4,+1)
│ ├── interesting orderings: (+1)
│ └── unfiltered-cols: (1-5)
├── scan xysd
│ ├── columns: x:6(int!null) y:7(int) s:8(string) d:9(decimal!null)
Expand Down Expand Up @@ -2008,13 +2008,13 @@ inner-join (hash)
├── fd: (1)-->(2-4), (6)-->(7-9), (8,9)~~>(6,7), (3)==(6), (6)==(3)
├── prune: (1,2,4,7-9,11)
├── reject-nulls: (6-9,11)
├── interesting orderings: (+1) (+3,+1) (+4,+1) (+6) (-8,+9,+6)
├── interesting orderings: (+1) (+6) (-8,+9,+6)
├── scan fk
│ ├── columns: k:1(int!null) v:2(int) r1:3(int!null) r2:4(int)
│ ├── key: (1)
│ ├── fd: (1)-->(2-4)
│ ├── prune: (1-4)
│ ├── interesting orderings: (+1) (+3,+1) (+4,+1)
│ ├── interesting orderings: (+1)
│ └── unfiltered-cols: (1-5)
├── full-join (cross)
│ ├── columns: x:6(int) y:7(int) s:8(string) d:9(decimal) column1:11(int)
Expand Down Expand Up @@ -2057,14 +2057,14 @@ inner-join (hash)
├── key: (1)
├── fd: (1)-->(2-4), (6)-->(7-9), (8,9)~~>(6,7), (11)-->(12-14), (13,14)~~>(11,12), (6)==(3,11), (11)==(3,6), (3)==(6,11)
├── prune: (1,2,4,7-9,12-14)
├── interesting orderings: (+1) (+3,+1) (+4,+1) (+6) (-8,+9,+6) (+11) (-13,+14,+11)
├── interesting orderings: (+1) (+6) (-8,+9,+6) (+11) (-13,+14,+11)
├── join-size: 2
├── scan fk
│ ├── columns: k:1(int!null) v:2(int) r1:3(int!null) r2:4(int)
│ ├── key: (1)
│ ├── fd: (1)-->(2-4)
│ ├── prune: (1-4)
│ ├── interesting orderings: (+1) (+3,+1) (+4,+1)
│ ├── interesting orderings: (+1)
│ └── unfiltered-cols: (1-5)
├── inner-join (hash)
│ ├── columns: xysd.x:6(int!null) xysd.y:7(int) xysd.s:8(string) xysd.d:9(decimal!null) a.x:11(int!null) a.y:12(int) a.s:13(string) a.d:14(decimal!null)
Expand Down Expand Up @@ -2107,14 +2107,14 @@ inner-join (hash)
├── key: (1)
├── fd: (1)-->(2-4), (6)==(3,11), (11)==(3,6), (3)==(6,11)
├── prune: (1,2,4)
├── interesting orderings: (+1) (+3,+1) (+4,+1) (+6) (+11)
├── interesting orderings: (+1) (+6) (+11)
├── join-size: 2
├── scan fk
│ ├── columns: k:1(int!null) v:2(int) r1:3(int!null) r2:4(int)
│ ├── key: (1)
│ ├── fd: (1)-->(2-4)
│ ├── prune: (1-4)
│ ├── interesting orderings: (+1) (+3,+1) (+4,+1)
│ ├── interesting orderings: (+1)
│ └── unfiltered-cols: (1-5)
├── inner-join (hash)
│ ├── columns: xysd.x:6(int!null) a.x:11(int!null)
Expand Down Expand Up @@ -2269,13 +2269,13 @@ inner-join (hash)
├── key: (1,6)
├── fd: (1)-->(2-4), (6)-->(7-9), (8,9)~~>(6,7), (3)==(7), (7)==(3)
├── prune: (1,2,4,6,8,9)
├── interesting orderings: (+1) (+3,+1) (+4,+1) (+6) (-8,+9,+6)
├── interesting orderings: (+1) (+6) (-8,+9,+6)
├── scan fk
│ ├── columns: k:1(int!null) v:2(int) r1:3(int!null) r2:4(int)
│ ├── key: (1)
│ ├── fd: (1)-->(2-4)
│ ├── prune: (1-4)
│ ├── interesting orderings: (+1) (+3,+1) (+4,+1)
│ ├── interesting orderings: (+1)
│ └── unfiltered-cols: (1-5)
├── scan xysd
│ ├── columns: x:6(int!null) y:7(int) s:8(string) d:9(decimal!null)
Expand All @@ -2300,13 +2300,13 @@ inner-join (hash)
├── key: (6)
├── fd: (1)-->(2-4), (6)-->(7), (7)~~>(6), (1)==(6), (6)==(1)
├── prune: (2-4,7)
├── interesting orderings: (+1) (+3,+1) (+4,+1) (+6) (+7,+6)
├── interesting orderings: (+1) (+6) (+7,+6)
├── scan fk
│ ├── columns: k:1(int!null) v:2(int) r1:3(int!null) r2:4(int)
│ ├── key: (1)
│ ├── fd: (1)-->(2-4)
│ ├── prune: (1-4)
│ ├── interesting orderings: (+1) (+3,+1) (+4,+1)
│ ├── interesting orderings: (+1)
│ └── unfiltered-cols: (1-5)
├── scan mn
│ ├── columns: m:6(int!null) n:7(int)
Expand All @@ -2331,11 +2331,10 @@ inner-join (hash)
├── columns: r1:1(int!null) r2:2(int!null) r3:3(int!null) a:6(int!null) b:7(int!null) c:8(int!null)
├── multiplicity: left-rows(zero-or-one), right-rows(zero-or-more)
├── fd: (1)==(6), (6)==(1), (2)==(7), (7)==(2), (3)==(8), (8)==(3)
├── interesting orderings: (+1,+2,+3) (+6,+7,+8)
├── interesting orderings: (+6,+7,+8)
├── scan ref
│ ├── columns: r1:1(int!null) r2:2(int) r3:3(int!null)
│ ├── prune: (1-3)
│ ├── interesting orderings: (+1,+2,+3)
│ └── unfiltered-cols: (1-5)
├── scan abc
│ ├── columns: a:6(int!null) b:7(int!null) c:8(int!null)
Expand Down Expand Up @@ -2365,15 +2364,13 @@ inner-join (hash)
├── columns: r1:1(int!null) r2:2(int!null) r3:3(int!null) a:6(int!null) b:7(int!null) c:8(int!null)
├── multiplicity: left-rows(exactly-one), right-rows(zero-or-more)
├── fd: (1)==(6), (6)==(1), (2)==(7), (7)==(2), (3)==(8), (8)==(3)
├── interesting orderings: (+1,+2,+3) (+6,+7,+8)
├── interesting orderings: (+6,+7,+8)
├── select
│ ├── columns: r1:1(int!null) r2:2(int!null) r3:3(int!null)
│ ├── prune: (1,3)
│ ├── interesting orderings: (+1,+2,+3)
│ ├── scan ref
│ │ ├── columns: r1:1(int!null) r2:2(int) r3:3(int!null)
│ │ ├── prune: (1-3)
│ │ └── interesting orderings: (+1,+2,+3)
│ │ └── prune: (1-3)
│ └── filters
│ └── is-not [type=bool, outer=(2), constraints=(/2: (/NULL - ]; tight)]
│ ├── variable: r2:2 [type=int]
Expand Down Expand Up @@ -2477,29 +2474,29 @@ limit
├── cardinality: [0 - 50]
├── fd: (10)-->(11,12), (12)==(14), (14)==(12), (1)==(6), (6)==(1), (2)==(8), (8)==(2), (3)==(10), (10)==(3)
├── prune: (11)
├── interesting orderings: (+1) (+2) (+3) (+6) (+8) (+10) (+11,+10) (+12,+10) (+14)
├── interesting orderings: (+6) (+8) (+10) (+14)
├── inner-join (hash)
│ ├── columns: t_st_id:1(int!null) t_tt_id:2(int!null) t_s_symb:3(int!null) st_id:6(int!null) tt_id:8(int!null) s_symb:10(int!null) s_st_id:11(int!null) s_ex_id:12(int!null) ex_id:14(int!null)
│ ├── multiplicity: left-rows(zero-or-more), right-rows(zero-or-one)
│ ├── fd: (10)-->(11,12), (12)==(14), (14)==(12), (1)==(6), (6)==(1), (2)==(8), (8)==(2), (3)==(10), (10)==(3)
│ ├── limit hint: 50.00
│ ├── prune: (11)
│ ├── interesting orderings: (+1) (+2) (+3) (+6) (+8) (+10) (+11,+10) (+12,+10) (+14)
│ ├── interesting orderings: (+6) (+8) (+10) (+14)
│ ├── join-size: 4
│ ├── inner-join (cross)
│ │ ├── columns: st_id:6(int!null) tt_id:8(int!null) s_symb:10(int!null) s_st_id:11(int!null) s_ex_id:12(int!null) ex_id:14(int!null)
│ │ ├── multiplicity: left-rows(one-or-more), right-rows(zero-or-more)
│ │ ├── key: (6,8,10)
│ │ ├── fd: (10)-->(11,12), (12)==(14), (14)==(12)
│ │ ├── prune: (6,8,10,11)
│ │ ├── interesting orderings: (+6) (+8) (+10) (+11,+10) (+12,+10) (+14)
│ │ ├── interesting orderings: (+6) (+8) (+10) (+14)
│ │ ├── join-size: 3
│ │ ├── inner-join (cross)
│ │ │ ├── columns: tt_id:8(int!null) s_symb:10(int!null) s_st_id:11(int!null) s_ex_id:12(int!null) ex_id:14(int!null)
│ │ │ ├── key: (8,10)
│ │ │ ├── fd: (10)-->(11,12), (12)==(14), (14)==(12)
│ │ │ ├── prune: (8,10,11)
│ │ │ ├── interesting orderings: (+8) (+10) (+11,+10) (+12,+10) (+14)
│ │ │ ├── interesting orderings: (+8) (+10) (+14)
│ │ │ ├── join-size: 2
│ │ │ ├── scan trade_type
│ │ │ │ ├── columns: tt_id:8(int!null)
Expand All @@ -2513,14 +2510,14 @@ limit
│ │ │ │ ├── key: (10)
│ │ │ │ ├── fd: (10)-->(11,12), (12)==(14), (14)==(12)
│ │ │ │ ├── prune: (10,11)
│ │ │ │ ├── interesting orderings: (+10) (+11,+10) (+12,+10) (+14)
│ │ │ │ ├── interesting orderings: (+10) (+14)
│ │ │ │ ├── unfiltered-cols: (10-13)
│ │ │ │ ├── scan security
│ │ │ │ │ ├── columns: s_symb:10(int!null) s_st_id:11(int!null) s_ex_id:12(int!null)
│ │ │ │ │ ├── key: (10)
│ │ │ │ │ ├── fd: (10)-->(11,12)
│ │ │ │ │ ├── prune: (10-12)
│ │ │ │ │ ├── interesting orderings: (+10) (+11,+10) (+12,+10)
│ │ │ │ │ ├── interesting orderings: (+10)
│ │ │ │ │ └── unfiltered-cols: (10-13)
│ │ │ │ ├── scan exchange
│ │ │ │ │ ├── columns: ex_id:14(int!null)
Expand All @@ -2543,7 +2540,6 @@ limit
│ ├── scan trade
│ │ ├── columns: t_st_id:1(int!null) t_tt_id:2(int!null) t_s_symb:3(int!null)
│ │ ├── prune: (1-3)
│ │ ├── interesting orderings: (+1) (+2) (+3)
│ │ └── unfiltered-cols: (1-5)
│ └── filters
│ ├── eq [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)]
Expand Down Expand Up @@ -2578,11 +2574,10 @@ left-join (hash)
├── multiplicity: left-rows(exactly-one), right-rows(zero-or-more)
├── fd: (5)-->(6), (6)-->(5)
├── reject-nulls: (5,6)
├── interesting orderings: (+1) (+2) (+5) (+6)
├── interesting orderings: (+5) (+6)
├── scan child
│ ├── columns: r_a:1(int!null) r_b:2(int!null)
│ ├── prune: (1,2)
│ ├── interesting orderings: (+1) (+2)
│ └── unfiltered-cols: (1-4)
├── scan parent
│ ├── columns: a:5(int!null) b:6(int!null)
Expand Down
Loading

0 comments on commit 979f4ad

Please sign in to comment.