From b5635948ab165b6070e7d05d111f966e07570d81 Mon Sep 17 00:00:00 2001 From: Andrew Gierth Date: Mon, 27 Mar 2017 04:20:54 +0100 Subject: Support hashed aggregation with grouping sets. This extends the Aggregate node with two new features: HashAggregate can now run multiple hashtables concurrently, and a new strategy MixedAggregate populates hashtables while doing sorted grouping. The planner will now attempt to save as many sorts as possible when planning grouping sets queries, while not exceeding work_mem for the estimated combined sizes of all hashtables used. No SQL-level changes are required. There should be no user-visible impact other than the new EXPLAIN output and possible changes to result ordering when ORDER BY was not used (which affected a few regression tests). The enable_hashagg option is respected. Author: Andrew Gierth Reviewers: Mark Dilger, Andres Freund Discussion: https://postgr.es/m/87vatszyhj.fsf@news-spur.riddles.org.uk --- src/include/lib/knapsack.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/include/lib/knapsack.h (limited to 'src/include/lib/knapsack.h') diff --git a/src/include/lib/knapsack.h b/src/include/lib/knapsack.h new file mode 100644 index 00000000000..8d1e6d0aa04 --- /dev/null +++ b/src/include/lib/knapsack.h @@ -0,0 +1,17 @@ +/* + * knapsack.h + * + * Copyright (c) 2017, PostgreSQL Global Development Group + * + * src/include/lib/knapsack.h + */ +#ifndef KNAPSACK_H +#define KNAPSACK_H + +#include "postgres.h" +#include "nodes/bitmapset.h" + +extern Bitmapset *DiscreteKnapsack(int max_weight, int num_items, + int *item_weights, double *item_values); + +#endif /* KNAPSACK_H */ -- cgit v1.2.3