IndexBuildResult *result;
BlockNumber relpages;
double reltuples;
+ float4 reloscache;
+ float4 relpgcache;
uint32 num_buckets;
HashBuildState buildstate;
RelationGetRelationName(index));
/* Estimate the number of rows currently present in the table */
- estimate_rel_size(heap, NULL, &relpages, &reltuples);
+ estimate_rel_size(heap, NULL, &relpages, &reltuples, &reloscache, &relpgcache);
/* Initialize the hash index metadata page and initial buckets */
num_buckets = _hash_metapinit(index, reltuples, MAIN_FORKNUM);
*/
if (!inhparent)
estimate_rel_size(relation, rel->attr_widths - rel->min_attr,
- &rel->pages, &rel->tuples);
+ &rel->pages, &rel->tuples,
+ &rel->oscache, &rel->pgcache);
/*
* Make list of indexes. Ignore indexes on system catalogs if told to.
{
info->pages = RelationGetNumberOfBlocks(indexRelation);
info->tuples = rel->tuples;
+ info->oscache = 0;
+ info->pgcache = 0;
}
else
{
estimate_rel_size(indexRelation, NULL,
- &info->pages, &info->tuples);
+ &info->pages, &info->tuples,
+ &info->oscache, &info->pgcache);
if (info->tuples > rel->tuples)
info->tuples = rel->tuples;
}
*/
void
estimate_rel_size(Relation rel, int32 *attr_widths,
- BlockNumber *pages, double *tuples)
+ BlockNumber *pages, double *tuples,
+ float4 *oscache, float4 *pgcache)
{
BlockNumber curpages;
BlockNumber relpages;
density = (BLCKSZ - SizeOfPageHeaderData) / tuple_width;
}
*tuples = rint(density * (double) curpages);
+ *oscache = (float4) rel->rd_rel->reloscache;
+ *pgcache = (float4) rel->rd_rel->relpgcache;
break;
case RELKIND_SEQUENCE:
/* Sequences always have a known size */
*pages = 1;
*tuples = 1;
+ *oscache = 0;
+ *pgcache = 0;
break;
case RELKIND_FOREIGN_TABLE:
/* Just use whatever's in pg_class */
*pages = rel->rd_rel->relpages;
*tuples = rel->rd_rel->reltuples;
+ *oscache = 0;
+ *pgcache = 0;
break;
default:
/* else it has no disk storage; probably shouldn't get here? */
*pages = 0;
*tuples = 0;
+ *oscache = 0;
+ *pgcache = 0;
break;
}
}
List *indexlist; /* list of IndexOptInfo */
BlockNumber pages;
double tuples;
+ float4 oscache;
+ float4 pgcache;
struct Plan *subplan; /* if subquery */
List *subrtable; /* if subquery */
List *subrowmark; /* if subquery */
/* statistics from pg_class */
BlockNumber pages; /* number of disk pages in index */
double tuples; /* number of index tuples in index */
+ float4 oscache;
+ float4 pgcache;
/* index descriptor information */
int ncolumns; /* number of columns in index */
bool inhparent, RelOptInfo *rel);
extern void estimate_rel_size(Relation rel, int32 *attr_widths,
- BlockNumber *pages, double *tuples);
+ BlockNumber *pages, double *tuples,
+ float4 *oscache, float4 *pgcache);
extern int32 get_relation_data_width(Oid relid, int32 *attr_widths);