Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
partdesc.h76 linesDownload Raw Back to partitioning
1/*-------------------------------------------------------------------------2 *3 * partdesc.h4 *5 * Copyright (c) 1996-2023, PostgreSQL Global Development Group6 *7 * src/include/partitioning/partdesc.h8 *9 *-------------------------------------------------------------------------10 */11 12#ifndef PARTDESC_H13#define PARTDESC_H14 15#include "partitioning/partdefs.h"16#include "utils/relcache.h"17 18/*19 * Information about partitions of a partitioned table.20 *21 * For partitioned tables where detached partitions exist, we only cache22 * descriptors that include all partitions, including detached; when we're23 * requested a descriptor without the detached partitions, we create one24 * afresh each time.  (The reason for this is that the set of detached25 * partitions that are visible to each caller depends on the snapshot it has,26 * so it's pretty much impossible to evict a descriptor from cache at the27 * right time.)28 */29typedef struct PartitionDescData30{31	int			nparts;			/* Number of partitions */32	bool		detached_exist; /* Are there any detached partitions? */33	Oid		   *oids;			/* Array of 'nparts' elements containing34								 * partition OIDs in order of their bounds */35	bool	   *is_leaf;		/* Array of 'nparts' elements storing whether36								 * the corresponding 'oids' element belongs to37								 * a leaf partition or not */38	PartitionBoundInfo boundinfo;	/* collection of partition bounds */39 40	/* Caching fields to cache lookups in get_partition_for_tuple() */41 42	/*43	 * Index into the PartitionBoundInfo's datum array for the last found44	 * partition or -1 if none.45	 */46	int			last_found_datum_index;47 48	/*49	 * Partition index of the last found partition or -1 if none has been50	 * found yet.51	 */52	int			last_found_part_index;53 54	/*55	 * For LIST partitioning, this is the number of times in a row that the56	 * datum we're looking for a partition for matches the datum in the57	 * last_found_datum_index index of the boundinfo->datums array.  For RANGE58	 * partitioning, this is the number of times in a row we've found that the59	 * datum we're looking for a partition for falls into the range of the60	 * partition corresponding to the last_found_datum_index index of the61	 * boundinfo->datums array.62	 */63	int			last_found_count;64} PartitionDescData;65 66 67extern PartitionDesc RelationGetPartitionDesc(Relation rel, bool omit_detached);68 69extern PartitionDirectory CreatePartitionDirectory(MemoryContext mcxt, bool omit_detached);70extern PartitionDesc PartitionDirectoryLookup(PartitionDirectory, Relation);71extern void DestroyPartitionDirectory(PartitionDirectory pdir);72 73extern Oid	get_default_oid_from_partdesc(PartitionDesc partdesc);74 75#endif							/* PARTCACHE_H */76 
codekingpro/portable-devtools · Team Ai