Skip to content

Instantly share code, notes, and snippets.

@rueian
Created January 1, 2020 18:04
Show Gist options
  • Save rueian/b0c04b1eae208c5693874bced1e24efd to your computer and use it in GitHub Desktop.
Save rueian/b0c04b1eae208c5693874bced1e24efd to your computer and use it in GitHub Desktop.
/*
* If we have most-common-values info, add up the fractions of the MCV
* entries that satisfy MCV OP PATTERN. These fractions contribute
* directly to the result selectivity. Also add up the total fraction
* represented by MCV entries.
*/
mcv_selec = mcv_selectivity(&vardata, &opproc, constval, true,
&sumcommon);
/*
* Now merge the results from the MCV and histogram calculations,
* realizing that the histogram covers only the non-null values that
* are not listed in MCV.
*/
selec *= 1.0 - nullfrac - sumcommon;
selec += mcv_selec;
result = selec;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment