mirror of
https://git.postgresql.org/git/postgresql.git
synced 2026-02-12 01:18:35 +08:00
hashjoinable clause, not one path for a randomly-chosen element of each set of clauses with the same join operator. That is, if you wrote SELECT ... WHERE t1.f1 = t2.f2 and t1.f3 = t2.f4, and both '=' ops were the same opcode (say, all four fields are int4), then the system would either consider hashing on f1=f2 or on f3=f4, but it would *not* consider both possibilities. Boo hiss. Also, revise estimation of hashjoin costs to include a penalty when the inner join var has a high disbursion --- ie, the most common value is pretty common. This tends to lead to badly skewed hash bucket occupancy and way more comparisons than you'd expect on average. I imagine that the cost calculation still needs tweaking, but at least it generates a more reasonable plan than before on George Young's example.
53 lines
1.8 KiB
C
53 lines
1.8 KiB
C
/*-------------------------------------------------------------------------
|
|
*
|
|
* pathnode.h
|
|
* prototypes for pathnode.c, indexnode.c, relnode.c.
|
|
*
|
|
*
|
|
* Copyright (c) 1994, Regents of the University of California
|
|
*
|
|
* $Id: pathnode.h,v 1.20 1999/08/06 04:00:13 tgl Exp $
|
|
*
|
|
*-------------------------------------------------------------------------
|
|
*/
|
|
#ifndef PATHNODE_H
|
|
#define PATHNODE_H
|
|
|
|
#include "nodes/relation.h"
|
|
|
|
/*
|
|
* prototypes for pathnode.c
|
|
*/
|
|
extern bool path_is_cheaper(Path *path1, Path *path2);
|
|
extern Path *set_cheapest(RelOptInfo *parent_rel, List *pathlist);
|
|
extern List *add_pathlist(RelOptInfo *parent_rel, List *unique_paths,
|
|
List *new_paths);
|
|
extern Path *create_seqscan_path(RelOptInfo *rel);
|
|
extern IndexPath *create_index_path(Query *root, RelOptInfo *rel, RelOptInfo *index,
|
|
List *restriction_clauses);
|
|
extern NestPath *create_nestloop_path(RelOptInfo *joinrel, RelOptInfo *outer_rel,
|
|
Path *outer_path, Path *inner_path, List *pathkeys);
|
|
extern MergePath *create_mergejoin_path(RelOptInfo *joinrel, int outersize,
|
|
int innersize, int outerwidth, int innerwidth, Path *outer_path,
|
|
Path *inner_path, List *pathkeys, MergeOrder *order,
|
|
List *mergeclauses, List *outersortkeys, List *innersortkeys);
|
|
|
|
extern HashPath *create_hashjoin_path(RelOptInfo *joinrel, int outersize,
|
|
int innersize, int outerwidth, int innerwidth, Path *outer_path,
|
|
Path *inner_path, List *pathkeys, Oid operator, List *hashclauses,
|
|
List *outerkeys, List *innerkeys, Cost innerdisbursion);
|
|
|
|
/*
|
|
* prototypes for rel.c
|
|
*/
|
|
extern RelOptInfo *rel_member(Relids relid, List *rels);
|
|
extern RelOptInfo *get_base_rel(Query *root, int relid);
|
|
extern RelOptInfo *get_join_rel(Query *root, Relids relid);
|
|
|
|
/*
|
|
* prototypes for indexnode.h
|
|
*/
|
|
extern List *find_relation_indices(Query *root, RelOptInfo *rel);
|
|
|
|
#endif /* PATHNODE_H */
|