mirror of
https://github.com/postgres/postgres.git
synced 2025-09-05 02:22:28 +03:00
Rewrite of planner statistics-gathering code. ANALYZE is now available as
a separate statement (though it can still be invoked as part of VACUUM, too). pg_statistic redesigned to be more flexible about what statistics are stored. ANALYZE now collects a list of several of the most common values, not just one, plus a histogram (not just the min and max values). Random sampling is used to make the process reasonably fast even on very large tables. The number of values and histogram bins collected is now user-settable via an ALTER TABLE command. There is more still to do; the new stats are not being used everywhere they could be in the planner. But the remaining changes for this project should be localized, and the behavior is already better than before. A not-very-related change is that sorting now makes use of btree comparison routines if it can find one, rather than invoking '<' twice.
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: tuplesort.h,v 1.6 2001/01/24 19:43:29 momjian Exp $
|
||||
* $Id: tuplesort.h,v 1.7 2001/05/07 00:43:26 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -36,8 +36,9 @@ typedef struct Tuplesortstate Tuplesortstate;
|
||||
*/
|
||||
|
||||
extern Tuplesortstate *tuplesort_begin_heap(TupleDesc tupDesc,
|
||||
int nkeys, ScanKey keys,
|
||||
bool randomAccess);
|
||||
int nkeys,
|
||||
Oid *sortOperators, AttrNumber *attNums,
|
||||
bool randomAccess);
|
||||
extern Tuplesortstate *tuplesort_begin_index(Relation indexRel,
|
||||
bool enforceUnique,
|
||||
bool randomAccess);
|
||||
@@ -75,4 +76,19 @@ extern void tuplesort_rescan(Tuplesortstate *state);
|
||||
extern void tuplesort_markpos(Tuplesortstate *state);
|
||||
extern void tuplesort_restorepos(Tuplesortstate *state);
|
||||
|
||||
/*
|
||||
* This routine selects an appropriate sorting function to implement
|
||||
* a sort operator as efficiently as possible.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
SORTFUNC_LT, /* raw "<" operator */
|
||||
SORTFUNC_CMP, /* -1 / 0 / 1 three-way comparator */
|
||||
SORTFUNC_REVCMP /* 1 / 0 / -1 (reversed) 3-way comparator */
|
||||
} SortFunctionKind;
|
||||
|
||||
extern void SelectSortFunction(Oid sortOperator,
|
||||
RegProcedure *sortFunction,
|
||||
SortFunctionKind *kind);
|
||||
|
||||
#endif /* TUPLESORT_H */
|
||||
|
Reference in New Issue
Block a user