Re: Partition-wise join for join between (declaratively) partitioned tables
Amit Langote <langote_amit_f8@lab.ntt.co.jp>
On 2017/03/14 9:17, Robert Haas wrote: > On Mon, Mar 13, 2017 at 3:24 PM, Robert Haas <robertmhaas@gmail.com> wrote: >> Haven't looked at 0007 yet. > > Overall this one looks pretty good and straightforward. In the following code of find_partition_scheme(): + /* Did not find matching partition scheme. Create one. */ + part_scheme = (PartitionScheme) palloc0(sizeof(PartitionSchemeData)); + + /* Copy partition bounds/lists. */ + part_scheme->nparts = part_desc->nparts; + part_scheme->strategy = part_key->strategy; + part_scheme->boundinfo = part_desc->boundinfo; + + /* Store partition key information. */ + part_scheme->partnatts = part_key->partnatts; + + part_scheme->partopfamily = (Oid *) palloc(sizeof(Oid) * partnatts); + memcpy(part_scheme->partopfamily, part_key->partopfamily, + sizeof(Oid) * partnatts); + + part_scheme->partopcintype = (Oid *) palloc(sizeof(Oid) * partnatts); + memcpy(part_scheme->partopcintype, part_key->partopcintype, + sizeof(Oid) * partnatts); + + part_scheme->key_types = (Oid *) palloc(sizeof(Oid) * partnatts); + memcpy(part_scheme->key_types, part_key->parttypid, + sizeof(Oid) * partnatts); + + part_scheme->key_typmods = (int32 *) palloc(sizeof(int32) * partnatts); + memcpy(part_scheme->key_typmods, part_key->parttypmod, + sizeof(int32) * partnatts); + + part_scheme->key_collations = (Oid *) palloc(sizeof(Oid) * partnatts); + memcpy(part_scheme->key_collations, part_key->parttypcoll, + sizeof(Oid) * partnatts); Couldn't we avoid the memcpy() on individual members of part_key? After all, RelationData.rd_partkey is guarded just like rd_partdesc by relcache.c in face of invalidations (see keep_partkey logic in RelationClearRelation). Thanks, Amit
Commits
-
Basic partition-wise join functionality.
- f49842d1ee31 11.0 landed
-
Assorted preparatory refactoring for partition-wise join.
- e139f1953f29 11.0 landed
-
Teach adjust_appendrel_attrs(_multilevel) to do multiple translations.
- 480f1f4329f1 11.0 landed
-
Stamp 10beta2.
- 42171e2cd23c 10.0 cited
-
Eat XIDs more efficiently in recovery TAP test.
- 08aed6604de2 10.0 cited
-
Abstract logic to allow for multiple kinds of child rels.
- 7a39b5e4d112 10.0 landed
-
Implement SortSupport for macaddr data type
- f90d23d0c518 10.0 cited
-
Attempt to stabilize grouping sets regression test plans.
- de4da168d57d 10.0 cited
-
Teach xlogreader to follow timeline switches
- 1148e22a82ed 10.0 cited
-
Don't scan partitioned tables.
- d3cc37f1d801 10.0 cited
-
Fix grammar.
- b4ff8609dbad 10.0 cited
-
postgres_fdw: Push down FULL JOINs with restriction clauses.
- b30fb56b07a8 10.0 cited
-
Some preliminary refactoring towards partitionwise join.
- c44c47a773bd 10.0 landed
-
contrib/amcheck needs RecentGlobalXmin to be PGDLLIMPORT'ified.
- 56018bf26eec 10.0 cited
-
Print test parameters like "foo: 123", and results like "foo = 123".
- 2a7f4f76434d 10.0 cited