mirror of
https://github.com/postgres/postgres.git
synced 2025-11-19 13:42:17 +03:00
Initial pgindent run for v12.
This is still using the 2.0 version of pg_bsd_indent. I thought it would be good to commit this separately, so as to document the differences between 2.0 and 2.1 behavior. Discussion: https://postgr.es/m/16296.1558103386@sss.pgh.pa.us
This commit is contained in:
@@ -209,20 +209,20 @@ statext_mcv_build(int numrows, HeapTuple *rows, Bitmapset *attrs,
|
||||
*
|
||||
* Using the same algorithm might exclude items that are close to the
|
||||
* "average" frequency of the sample. But that does not say whether the
|
||||
* observed frequency is close to the base frequency or not. We also
|
||||
* need to consider unexpectedly uncommon items (again, compared to the
|
||||
* base frequency), and the single-column algorithm does not have to.
|
||||
* observed frequency is close to the base frequency or not. We also need
|
||||
* to consider unexpectedly uncommon items (again, compared to the base
|
||||
* frequency), and the single-column algorithm does not have to.
|
||||
*
|
||||
* We simply decide how many items to keep by computing minimum count
|
||||
* using get_mincount_for_mcv_list() and then keep all items that seem
|
||||
* to be more common than that.
|
||||
* using get_mincount_for_mcv_list() and then keep all items that seem to
|
||||
* be more common than that.
|
||||
*/
|
||||
mincount = get_mincount_for_mcv_list(numrows, totalrows);
|
||||
|
||||
/*
|
||||
* Walk the groups until we find the first group with a count below
|
||||
* the mincount threshold (the index of that group is the number of
|
||||
* groups we want to keep).
|
||||
* Walk the groups until we find the first group with a count below the
|
||||
* mincount threshold (the index of that group is the number of groups we
|
||||
* want to keep).
|
||||
*/
|
||||
for (i = 0; i < nitems; i++)
|
||||
{
|
||||
@@ -240,7 +240,7 @@ statext_mcv_build(int numrows, HeapTuple *rows, Bitmapset *attrs,
|
||||
*/
|
||||
if (nitems > 0)
|
||||
{
|
||||
int j;
|
||||
int j;
|
||||
|
||||
/*
|
||||
* Allocate the MCV list structure, set the global parameters.
|
||||
@@ -485,7 +485,7 @@ statext_mcv_load(Oid mvoid)
|
||||
* (or a longer type) instead of using an array of bool items.
|
||||
*/
|
||||
bytea *
|
||||
statext_mcv_serialize(MCVList * mcvlist, VacAttrStats **stats)
|
||||
statext_mcv_serialize(MCVList *mcvlist, VacAttrStats **stats)
|
||||
{
|
||||
int i;
|
||||
int dim;
|
||||
@@ -603,7 +603,7 @@ statext_mcv_serialize(MCVList * mcvlist, VacAttrStats **stats)
|
||||
info[dim].nbytes = 0;
|
||||
for (i = 0; i < info[dim].nvalues; i++)
|
||||
{
|
||||
Size len;
|
||||
Size len;
|
||||
|
||||
values[dim][i] = PointerGetDatum(PG_DETOAST_DATUM(values[dim][i]));
|
||||
|
||||
@@ -616,7 +616,7 @@ statext_mcv_serialize(MCVList * mcvlist, VacAttrStats **stats)
|
||||
info[dim].nbytes = 0;
|
||||
for (i = 0; i < info[dim].nvalues; i++)
|
||||
{
|
||||
Size len;
|
||||
Size len;
|
||||
|
||||
/* c-strings include terminator, so +1 byte */
|
||||
values[dim][i] = PointerGetDatum(PG_DETOAST_DATUM(values[dim][i]));
|
||||
@@ -636,11 +636,11 @@ statext_mcv_serialize(MCVList * mcvlist, VacAttrStats **stats)
|
||||
* for each attribute, deduplicated values and items).
|
||||
*
|
||||
* The header fields are copied one by one, so that we don't need any
|
||||
* explicit alignment (we copy them while deserializing). All fields
|
||||
* after this need to be properly aligned, for direct access.
|
||||
* explicit alignment (we copy them while deserializing). All fields after
|
||||
* this need to be properly aligned, for direct access.
|
||||
*/
|
||||
total_length = MAXALIGN(VARHDRSZ + (3 * sizeof(uint32))
|
||||
+ sizeof(AttrNumber) + (ndims * sizeof(Oid)));
|
||||
+ sizeof(AttrNumber) + (ndims * sizeof(Oid)));
|
||||
|
||||
/* dimension info */
|
||||
total_length += MAXALIGN(ndims * sizeof(DimensionInfo));
|
||||
@@ -650,14 +650,14 @@ statext_mcv_serialize(MCVList * mcvlist, VacAttrStats **stats)
|
||||
total_length += MAXALIGN(info[i].nbytes);
|
||||
|
||||
/*
|
||||
* And finally the items (no additional alignment needed, we start
|
||||
* at proper alignment and the itemsize formula uses MAXALIGN)
|
||||
* And finally the items (no additional alignment needed, we start at
|
||||
* proper alignment and the itemsize formula uses MAXALIGN)
|
||||
*/
|
||||
total_length += mcvlist->nitems * itemsize;
|
||||
|
||||
/*
|
||||
* Allocate space for the whole serialized MCV list (we'll skip bytes,
|
||||
* so we set them to zero to make the result more compressible).
|
||||
* Allocate space for the whole serialized MCV list (we'll skip bytes, so
|
||||
* we set them to zero to make the result more compressible).
|
||||
*/
|
||||
raw = palloc0(total_length);
|
||||
SET_VARSIZE(raw, total_length);
|
||||
@@ -1189,8 +1189,8 @@ pg_stats_ext_mcvlist_items(PG_FUNCTION_ARGS)
|
||||
HeapTuple tuple;
|
||||
Datum result;
|
||||
|
||||
StringInfoData itemValues;
|
||||
StringInfoData itemNulls;
|
||||
StringInfoData itemValues;
|
||||
StringInfoData itemNulls;
|
||||
|
||||
int i;
|
||||
|
||||
@@ -1213,9 +1213,9 @@ pg_stats_ext_mcvlist_items(PG_FUNCTION_ARGS)
|
||||
*/
|
||||
values = (char **) palloc0(5 * sizeof(char *));
|
||||
|
||||
values[0] = (char *) palloc(64 * sizeof(char)); /* item index */
|
||||
values[3] = (char *) palloc(64 * sizeof(char)); /* frequency */
|
||||
values[4] = (char *) palloc(64 * sizeof(char)); /* base frequency */
|
||||
values[0] = (char *) palloc(64 * sizeof(char)); /* item index */
|
||||
values[3] = (char *) palloc(64 * sizeof(char)); /* frequency */
|
||||
values[4] = (char *) palloc(64 * sizeof(char)); /* base frequency */
|
||||
|
||||
outfuncs = (Oid *) palloc0(sizeof(Oid) * mcvlist->ndimensions);
|
||||
fmgrinfo = (FmgrInfo *) palloc0(sizeof(FmgrInfo) * mcvlist->ndimensions);
|
||||
@@ -1376,7 +1376,7 @@ pg_mcv_list_send(PG_FUNCTION_ARGS)
|
||||
*/
|
||||
static bool *
|
||||
mcv_get_match_bitmap(PlannerInfo *root, List *clauses,
|
||||
Bitmapset *keys, MCVList * mcvlist, bool is_or)
|
||||
Bitmapset *keys, MCVList *mcvlist, bool is_or)
|
||||
{
|
||||
int i;
|
||||
ListCell *l;
|
||||
|
||||
Reference in New Issue
Block a user