gooderp18绿色标准版
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 line
2.9KB

  1. /*-------------------------------------------------------------------------
  2. *
  3. * partprune.h
  4. * prototypes for partprune.c
  5. *
  6. *
  7. * Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group
  8. * Portions Copyright (c) 1994, Regents of the University of California
  9. *
  10. * src/include/partitioning/partprune.h
  11. *
  12. *-------------------------------------------------------------------------
  13. */
  14. #ifndef PARTPRUNE_H
  15. #define PARTPRUNE_H
  16. #include "nodes/execnodes.h"
  17. #include "partitioning/partdefs.h"
  18. struct PlannerInfo; /* avoid including pathnodes.h here */
  19. struct RelOptInfo;
  20. /*
  21. * PartitionPruneContext
  22. * Stores information needed at runtime for pruning computations
  23. * related to a single partitioned table.
  24. *
  25. * strategy Partition strategy, e.g. LIST, RANGE, HASH.
  26. * partnatts Number of columns in the partition key.
  27. * nparts Number of partitions in this partitioned table.
  28. * boundinfo Partition boundary info for the partitioned table.
  29. * partcollation Array of partnatts elements, storing the collations of the
  30. * partition key columns.
  31. * partsupfunc Array of FmgrInfos for the comparison or hashing functions
  32. * associated with the partition keys (partnatts elements).
  33. * (This points into the partrel's partition key, typically.)
  34. * stepcmpfuncs Array of FmgrInfos for the comparison or hashing function
  35. * for each pruning step and partition key.
  36. * ppccontext Memory context holding this PartitionPruneContext's
  37. * subsidiary data, such as the FmgrInfos.
  38. * planstate Points to the parent plan node's PlanState when called
  39. * during execution; NULL when called from the planner.
  40. * exprstates Array of ExprStates, indexed as per PruneCxtStateIdx; one
  41. * for each partition key in each pruning step. Allocated if
  42. * planstate is non-NULL, otherwise NULL.
  43. */
  44. typedef struct PartitionPruneContext
  45. {
  46. char strategy;
  47. int partnatts;
  48. int nparts;
  49. PartitionBoundInfo boundinfo;
  50. Oid *partcollation;
  51. FmgrInfo *partsupfunc;
  52. FmgrInfo *stepcmpfuncs;
  53. MemoryContext ppccontext;
  54. PlanState *planstate;
  55. ExprState **exprstates;
  56. } PartitionPruneContext;
  57. /*
  58. * PruneCxtStateIdx() computes the correct index into the stepcmpfuncs[],
  59. * exprstates[] and exprhasexecparam[] arrays for step step_id and
  60. * partition key column keyno. (Note: there is code that assumes the
  61. * entries for a given step are sequential, so this is not chosen freely.)
  62. */
  63. #define PruneCxtStateIdx(partnatts, step_id, keyno) \
  64. ((partnatts) * (step_id) + (keyno))
  65. extern PartitionPruneInfo *make_partition_pruneinfo(struct PlannerInfo *root,
  66. struct RelOptInfo *parentrel,
  67. List *subpaths,
  68. List *partitioned_rels,
  69. List *prunequal);
  70. extern Bitmapset *prune_append_rel_partitions(struct RelOptInfo *rel);
  71. extern Bitmapset *get_matching_partitions(PartitionPruneContext *context,
  72. List *pruning_steps);
  73. #endif /* PARTPRUNE_H */
上海开阖软件有限公司 沪ICP备12045867号-1