Commit fcecc5ca authored by Bruce Momjian's avatar Bruce Momjian

[Part #1: Type: text/plain, Encoding: 7bit, Size: 59]

I will be cleaning this up more before the Oct 1 deadline.

David Hartwig.  AND/OR fix.
parent b25a513b
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* Routines for handling of 'SET var TO', * Routines for handling of 'SET var TO',
* 'SHOW var' and 'RESET var' statements. * 'SHOW var' and 'RESET var' statements.
* *
* $Id: variable.c,v 1.12 1998/09/01 04:28:07 momjian Exp $ * $Id: variable.c,v 1.13 1998/09/03 02:34:29 momjian Exp $
* *
*/ */
...@@ -24,6 +24,7 @@ extern Cost _cpu_index_page_wight_; ...@@ -24,6 +24,7 @@ extern Cost _cpu_index_page_wight_;
extern bool _use_geqo_; extern bool _use_geqo_;
extern int32 _use_geqo_rels_; extern int32 _use_geqo_rels_;
extern bool _use_right_sided_plans_; extern bool _use_right_sided_plans_;
extern bool _use_keyset_query_optimizer;
/*-----------------------------------------------------------------------*/ /*-----------------------------------------------------------------------*/
static const char * static const char *
...@@ -558,6 +559,9 @@ struct VariableParsers ...@@ -558,6 +559,9 @@ struct VariableParsers
"server_encoding", parse_server_encoding, show_server_encoding, reset_server_encoding "server_encoding", parse_server_encoding, show_server_encoding, reset_server_encoding
}, },
#endif #endif
{
"ksqo", parse_ksqo, show_ksqo, reset_ksqo
},
{ {
NULL, NULL, NULL, NULL NULL, NULL, NULL, NULL
} }
...@@ -613,3 +617,47 @@ ResetPGVariable(const char *name) ...@@ -613,3 +617,47 @@ ResetPGVariable(const char *name)
return TRUE; return TRUE;
} }
/*-----------------------------------------------------------------------
KSQO code will one day be unnecessary when the optimizer makes use of
indexes when multiple ORs are specified in the where clause.
See optimizer/prep/prepkeyset.c for more on this.
daveh@insightdist.com 6/16/98
-----------------------------------------------------------------------*/
bool
parse_ksqo(const char *value)
{
if (value == NULL)
{
reset_ksqo();
return TRUE;
}
if (strcasecmp(value, "on") == 0)
_use_keyset_query_optimizer = true;
else if (strcasecmp(value, "off") == 0)
_use_keyset_query_optimizer = false;
else
elog(ERROR, "Bad value for Key Set Query Optimizer (%s)", value);
return TRUE;
}
bool
show_ksqo()
{
if (_use_keyset_query_optimizer)
elog(NOTICE, "Key Set Query Optimizer is ON");
else
elog(NOTICE, "Key Set Query Optimizer is OFF");
return TRUE;
}
bool
reset_ksqo()
{
_use_keyset_query_optimizer = false;
return TRUE;
}
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planner.c,v 1.32 1998/09/01 04:29:53 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planner.c,v 1.33 1998/09/03 02:34:30 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -68,6 +68,7 @@ planner(Query *parse) ...@@ -68,6 +68,7 @@ planner(Query *parse)
PlannerInitPlan = NULL; PlannerInitPlan = NULL;
PlannerPlanId = 0; PlannerPlanId = 0;
transformKeySetQuery(parse);
result_plan = union_planner(parse); result_plan = union_planner(parse);
Assert(PlannerQueryLevel == 1); Assert(PlannerQueryLevel == 1);
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
# Makefile for optimizer/prep # Makefile for optimizer/prep
# #
# IDENTIFICATION # IDENTIFICATION
# $Header: /cvsroot/pgsql/src/backend/optimizer/prep/Makefile,v 1.7 1998/04/06 00:23:48 momjian Exp $ # $Header: /cvsroot/pgsql/src/backend/optimizer/prep/Makefile,v 1.8 1998/09/03 02:34:32 momjian Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
...@@ -13,7 +13,7 @@ include ../../../Makefile.global ...@@ -13,7 +13,7 @@ include ../../../Makefile.global
CFLAGS += -I../.. CFLAGS += -I../..
OBJS = prepqual.o preptlist.o prepunion.o OBJS = prepqual.o preptlist.o prepunion.o prepkeyset.o
# not ready yet: predmig.o xfunc.o # not ready yet: predmig.o xfunc.o
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* Headers for handling of 'SET var TO', 'SHOW var' and 'RESET var' * Headers for handling of 'SET var TO', 'SHOW var' and 'RESET var'
* statements * statements
* *
* $Id: variable.h,v 1.6 1998/09/01 04:35:40 momjian Exp $ * $Id: variable.h,v 1.7 1998/09/03 02:34:34 momjian Exp $
* *
*/ */
#ifndef VARIABLE_H #ifndef VARIABLE_H
...@@ -54,5 +54,8 @@ extern bool set_geqo(void); ...@@ -54,5 +54,8 @@ extern bool set_geqo(void);
extern bool show_geqo(void); extern bool show_geqo(void);
extern bool reset_geqo(void); extern bool reset_geqo(void);
extern bool parse_geqo(const char *); extern bool parse_geqo(const char *);
extern bool show_ksqo(void);
extern bool reset_ksqo(void);
extern bool parse_ksqo(const char *);
#endif /* VARIABLE_H */ #endif /* VARIABLE_H */
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * Copyright (c) 1994, Regents of the University of California
* *
* $Id: planmain.h,v 1.15 1998/09/01 04:37:17 momjian Exp $ * $Id: planmain.h,v 1.16 1998/09/03 02:34:35 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -61,5 +61,6 @@ extern void del_agg_tlist_references(List *tlist); ...@@ -61,5 +61,6 @@ extern void del_agg_tlist_references(List *tlist);
extern List *check_having_qual_for_aggs(Node *clause, extern List *check_having_qual_for_aggs(Node *clause,
List *subplanTargetList, List *groupClause); List *subplanTargetList, List *groupClause);
extern List *check_having_qual_for_vars(Node *clause, List *targetlist_so_far); extern List *check_having_qual_for_vars(Node *clause, List *targetlist_so_far);
extern void transformKeySetQuery(Query *origNode);
#endif /* PLANMAIN_H */ #endif /* PLANMAIN_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment