Permalink
Browse files

Fix of sampling (modulo returns 0..99 so we need to subtract 1 from t…

…he sample_pct).
  • Loading branch information...
1 parent ba891e5 commit c49494bf86a20f0531e6a8d7852cde3e8b2cd45f @tvondra committed Oct 30, 2011
Showing with 2 additions and 1 deletion.
  1. +2 −1 queryhist.c
View
@@ -284,7 +284,8 @@ explain_ExecutorEnd(QueryDesc *queryDesc)
/* Log plan if duration is exceeded. */
seconds = queryDesc->totaltime->total;
- if ((histogram_initialized) && (rand() % 100 < default_histogram_sample_pct)) {
+ /* N % 100 returns value 0-99, so we need to subtract 1 from the sample_pct */
+ if ((histogram_initialized) && (rand() % 100 < (default_histogram_sample_pct-1)) {
query_hist_add_query(seconds);
}

0 comments on commit c49494b

Please sign in to comment.