X-Git-Url: http://www.sigaev.ru/git/gitweb.cgi?p=plantuner.git;a=blobdiff_plain;f=plantuner.c;h=85954637707b817522f1c4722e719e35e54a3691;hp=050e3b7d32f9a703d4e7bbc384e9c9d3440d7ccd;hb=0bfe8d22e41a4a690ef9ca950f56c65ef194fe4d;hpb=0ed6fd76935293b13647a5bd59aff23e9b1029f5 diff --git a/plantuner.c b/plantuner.c index 050e3b7..8595463 100644 --- a/plantuner.c +++ b/plantuner.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -77,6 +78,22 @@ indexesAssign(const char * newval, bool doit, GucSource source, bool isDisable) if (!SplitIdentifierString(rawname, ',', &namelist)) goto cleanup; + /* + * follow work could be done only in normal processing because of + * accsess to system catalog + */ + if (MyBackendId == InvalidBackendId || !IsUnderPostmaster || + !IsTransactionState()) + { + /* reset init state */ + if (isDisable) + plantuner_disable_inited = false; + else + plantuner_enable_inited = false; + + return newval; + } + if (doit) { nOids = list_length(namelist); @@ -86,14 +103,6 @@ indexesAssign(const char * newval, bool doit, GucSource source, bool isDisable) (int)(sizeof(Oid) * (nOids+1))); } - /* - * follow work could be done only in normal processing because of - * accsess to system catalog - */ - if (MyBackendId == InvalidBackendId || !IsUnderPostmaster || - !IsNormalProcessingMode() || MyAuxProcType != NotAnAuxProcess) - return newval; - if (isDisable) plantuner_disable_inited = true; else @@ -282,7 +291,7 @@ execPlantuner(PlannerInfo *root, Oid relationObjectId, bool inhparent, * estimate_rel_size() could be too pessimistic for particular * workload */ - rel->pages = 0.0; + rel->pages = 1.0; rel->tuples = 0.0; }