Initial 9.5
[online_analyze.git] / online_analyze.c
1 /*
2  * Copyright (c) 2011 Teodor Sigaev <teodor@sigaev.ru>
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *        notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *        notice, this list of conditions and the following disclaimer in the
12  *        documentation and/or other materials provided with the distribution.
13  * 3. Neither the name of the author nor the names of any co-contributors
14  *        may be used to endorse or promote products derived from this software
15  *        without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY CONTRIBUTORS ``AS IS'' AND ANY EXPRESS
18  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL CONTRIBUTORS BE LIABLE FOR ANY
21  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
23  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
25  * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
26  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
27  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29
30 #include "postgres.h"
31
32 #include "pgstat.h"
33 #include "catalog/namespace.h"
34 #include "commands/vacuum.h"
35 #include "executor/executor.h"
36 #include "nodes/nodes.h"
37 #include "nodes/parsenodes.h"
38 #include "storage/bufmgr.h"
39 #include "utils/builtins.h"
40 #include "utils/lsyscache.h"
41 #include "utils/guc.h"
42 #if PG_VERSION_NUM >= 90200
43 #include "catalog/pg_class.h"
44 #include "nodes/primnodes.h"
45 #include "tcop/utility.h"
46 #include "utils/rel.h"
47 #include "utils/relcache.h"
48 #include "utils/timestamp.h"
49 #endif
50
51 #ifdef PG_MODULE_MAGIC
52 PG_MODULE_MAGIC;
53 #endif
54
55 static bool online_analyze_enable = true;
56 static bool online_analyze_verbose = true;
57 static double online_analyze_scale_factor = 0.1;
58 static int online_analyze_threshold = 50;
59 static double online_analyze_min_interval = 10000;
60
61 static ExecutorEnd_hook_type oldExecutorEndHook = NULL;
62 #if PG_VERSION_NUM >= 90200
63 static ProcessUtility_hook_type oldProcessUtilityHook = NULL;
64 #endif
65
66 typedef enum 
67 {
68         OATT_ALL                = 0x03,
69         OATT_PERSISTENT = 0x01,
70         OATT_TEMPORARY  = 0x02,
71         OATT_NONE               = 0x00
72 } OnlineAnalyzeTableType;
73
74 static const struct config_enum_entry online_analyze_table_type_options[] = 
75 {
76         {"all", OATT_ALL, false},
77         {"persistent", OATT_PERSISTENT, false},
78         {"temporary", OATT_TEMPORARY, false},
79         {"none", OATT_NONE, false},
80         {NULL, 0, false},
81 };
82
83 static int online_analyze_table_type = (int)OATT_ALL;
84
85 typedef struct TableList {
86         int             nTables;
87         Oid             *tables;
88         char    *tableStr;
89 } TableList;
90
91 static TableList excludeTables = {0, NULL, NULL};
92 static TableList includeTables = {0, NULL, NULL};
93
94 static int
95 oid_cmp(const void *a, const void *b)
96 {
97         if (*(Oid*)a == *(Oid*)b)
98                 return 0;
99         return (*(Oid*)a > *(Oid*)b) ? 1 : -1;
100 }
101
102 static const char *
103 tableListAssign(const char * newval, bool doit, TableList *tbl)
104 {
105         char       *rawname;
106         List       *namelist;
107         ListCell   *l;
108         Oid         *newOids = NULL;
109         int         nOids = 0,
110                                 i = 0;
111
112         rawname = pstrdup(newval);
113
114         if (!SplitIdentifierString(rawname, ',', &namelist))
115                 goto cleanup;
116
117         if (doit)
118         {
119                 nOids = list_length(namelist);
120                 newOids = malloc(sizeof(Oid) * (nOids+1));
121                 if (!newOids)
122                         elog(ERROR,"could not allocate %d bytes", (int)(sizeof(Oid) * (nOids+1)));
123         }
124
125         foreach(l, namelist)
126         {
127                 char        *curname = (char *) lfirst(l);
128 #if PG_VERSION_NUM >= 90200
129                 Oid         relOid = RangeVarGetRelid(makeRangeVarFromNameList(stringToQualifiedNameList(curname)), 
130                                                                                                 NoLock, true);
131 #else
132                 Oid         relOid = RangeVarGetRelid(makeRangeVarFromNameList(stringToQualifiedNameList(curname)), 
133                                                                                                 true);
134 #endif
135
136                 if (relOid == InvalidOid)
137                 {
138 #if PG_VERSION_NUM >= 90100
139                         if (doit == false)
140 #endif
141                         elog(WARNING,"'%s' does not exist", curname);
142                         continue;
143                 }
144                 else if ( get_rel_relkind(relOid) != RELKIND_RELATION )
145                 {
146 #if PG_VERSION_NUM >= 90100
147                         if (doit == false)
148 #endif
149                                 elog(WARNING,"'%s' is not an table", curname);
150                         continue;
151                 }
152                 else if (doit)
153                 {
154                         newOids[i++] = relOid;
155                 }
156         }
157
158         if (doit)
159         {
160                 tbl->nTables = i;
161                 if (tbl->tables)
162                         free(tbl->tables);
163                 tbl->tables = newOids;
164                 if (tbl->nTables > 1)
165                         qsort(tbl->tables, tbl->nTables, sizeof(tbl->tables[0]), oid_cmp);
166         }
167
168         pfree(rawname);
169         list_free(namelist);
170
171         return newval;
172
173 cleanup:
174         if (newOids)
175                 free(newOids);
176         pfree(rawname);
177         list_free(namelist);
178         return NULL;
179 }
180
181 #if PG_VERSION_NUM >= 90100
182 static bool
183 excludeTablesCheck(char **newval, void **extra, GucSource source)
184 {
185         char *val;
186
187         val = (char*)tableListAssign(*newval, false, &excludeTables);
188
189         if (val)
190         {
191                 *newval = val;
192                 return true;
193         }
194
195         return false;
196 }
197
198 static void
199 excludeTablesAssign(const char *newval, void *extra)
200 {
201         tableListAssign(newval, true, &excludeTables);
202 }
203
204 static bool
205 includeTablesCheck(char **newval, void **extra, GucSource source)
206 {
207         char *val;
208
209         val = (char*)tableListAssign(*newval, false, &includeTables);
210
211         if (val)
212         {
213                 *newval = val;
214                 return true;
215         }
216
217         return false;
218 }
219
220 static void
221 includeTablesAssign(const char *newval, void *extra)
222 {
223         tableListAssign(newval, true, &excludeTables);
224 }
225
226 #else /* PG_VERSION_NUM < 90100 */ 
227
228 static const char *
229 excludeTablesAssign(const char * newval, bool doit, GucSource source)
230 {
231         return tableListAssign(newval, doit, &excludeTables);
232 }
233
234 static const char *
235 includeTablesAssign(const char * newval, bool doit, GucSource source)
236 {
237         return tableListAssign(newval, doit, &includeTables);
238 }
239
240 #endif
241
242 static const char*
243 tableListShow(TableList *tbl)
244 {
245         char    *val, *ptr;
246         int     i,
247                         len;
248
249         len = 1 /* \0 */ + tbl->nTables * (2 * NAMEDATALEN + 2 /* ', ' */ + 1 /* . */);
250         ptr = val = palloc(len);
251         *ptr ='\0';
252         for(i=0; i<tbl->nTables; i++)
253         {
254                 char    *relname = get_rel_name(tbl->tables[i]);
255                 Oid     nspOid = get_rel_namespace(tbl->tables[i]);
256                 char    *nspname = get_namespace_name(nspOid);
257
258                 if ( relname == NULL || nspOid == InvalidOid || nspname == NULL )
259                         continue;
260
261                 ptr += snprintf(ptr, len - (ptr - val), "%s%s.%s",
262                                                                                                         (i==0) ? "" : ", ",
263                                                                                                         nspname, relname);
264         }
265
266         return val;
267 }
268
269 static const char*
270 excludeTablesShow(void)
271 {
272         return tableListShow(&excludeTables);
273 }
274
275 static const char*
276 includeTablesShow(void)
277 {
278         return tableListShow(&includeTables);
279 }
280
281 static bool
282 matchOid(TableList *tbl, Oid oid)
283 {
284         Oid     *StopLow = tbl->tables,
285                 *StopHigh = tbl->tables + tbl->nTables,
286                 *StopMiddle;
287
288         /* Loop invariant: StopLow <= val < StopHigh */
289         while (StopLow < StopHigh)
290         {
291                 StopMiddle = StopLow + ((StopHigh - StopLow) >> 1);
292
293                 if (*StopMiddle == oid)
294                         return true;
295                 else  if (*StopMiddle < oid)
296                         StopLow = StopMiddle + 1;
297                 else
298                         StopHigh = StopMiddle;
299         }
300
301         return false;
302 }
303
304 static void
305 makeAnalyze(Oid relOid, CmdType operation, uint32 naffected)
306 {
307         PgStat_StatTabEntry             *tabentry;
308         TimestampTz                     now = GetCurrentTimestamp();
309
310         if (relOid == InvalidOid)
311                 return;
312
313         if (get_rel_relkind(relOid) != RELKIND_RELATION)
314                 return;
315
316         tabentry = pgstat_fetch_stat_tabentry(relOid);
317
318 #if PG_VERSION_NUM >= 90000
319 #define changes_since_analyze(t)        ((t)->changes_since_analyze)
320 #else
321 #define changes_since_analyze(t)        ((t)->n_live_tuples + (t)->n_dead_tuples - (t)->last_anl_tuples)
322 #endif
323
324         if (
325                 tabentry == NULL /* a new table */ ||
326                 (
327                         /* do not analyze too often, if both stamps are exceeded the go */
328                         TimestampDifferenceExceeds(tabentry->analyze_timestamp, now, online_analyze_min_interval) && 
329                         TimestampDifferenceExceeds(tabentry->autovac_analyze_timestamp, now, online_analyze_min_interval) &&
330                         /* be in sync with relation_needs_vacanalyze */
331                         ((double)(changes_since_analyze(tabentry) + naffected)) >=
332                                 online_analyze_scale_factor * ((double)(tabentry->n_dead_tuples + tabentry->n_live_tuples)) + 
333                                         (double)online_analyze_threshold
334                 )
335         )
336         {
337 #if PG_VERSION_NUM < 90500
338                 VacuumStmt                              vacstmt;
339 #else
340                 VacuumParams                    vacstmt;
341 #endif
342                 TimestampTz                             startStamp, endStamp;
343
344                 memset(&startStamp, 0, sizeof(startStamp)); /* keep compiler quiet */
345
346                 /*
347                  * includeTables overwrites excludeTables
348                  */
349                 switch(online_analyze_table_type)
350                 {
351                         case OATT_ALL:
352                                 if (matchOid(&excludeTables, relOid) == true && matchOid(&includeTables, relOid) == false)
353                                         return;
354                                 break;
355                         case OATT_NONE:
356                                 if (matchOid(&includeTables, relOid) == false)
357                                         return;
358                                 break;
359                         case OATT_TEMPORARY:
360                         case OATT_PERSISTENT:
361                         default:
362                                 {
363                                         Relation                                rel;
364                                         OnlineAnalyzeTableType  reltype;
365
366                                         rel = RelationIdGetRelation(relOid);
367                                         reltype = 
368 #if PG_VERSION_NUM >= 90100
369                                                 (rel->rd_rel->relpersistence == RELPERSISTENCE_TEMP)
370 #else
371                                                 (rel->rd_istemp || rel->rd_islocaltemp)
372 #endif
373                                                         ? OATT_TEMPORARY : OATT_PERSISTENT;
374                                         RelationClose(rel);
375
376                                         /*
377                                          * skip analyze if relation's type doesn't not match online_analyze_table_type
378                                          */
379                                         if ((online_analyze_table_type & reltype) == 0 || matchOid(&excludeTables, relOid) == true)
380                                         {
381                                                 if (matchOid(&includeTables, relOid) == false)
382                                                         return;
383                                         }
384                                 }
385                                 break;
386                 }
387
388                 memset(&vacstmt, 0, sizeof(vacstmt));
389
390                 vacstmt.freeze_min_age = -1;
391                 vacstmt.freeze_table_age = -1; /* ??? */
392
393 #if PG_VERSION_NUM < 90500
394                 vacstmt.type = T_VacuumStmt;
395                 vacstmt.relation = NULL;
396                 vacstmt.va_cols = NIL;
397 #if PG_VERSION_NUM >= 90000
398                 vacstmt.options = VACOPT_ANALYZE;
399                 if (online_analyze_verbose)
400                         vacstmt.options |= VACOPT_VERBOSE;
401 #else
402                 vacstmt.vacuum = vacstmt.full = false;
403                 vacstmt.analyze = true;
404                 vacstmt.verbose = online_analyze_verbose;
405 #endif
406 #else
407                 vacstmt.multixact_freeze_min_age = -1;
408                 vacstmt.multixact_freeze_table_age = -1;
409                 vacstmt.log_min_duration = -1;
410 #endif
411
412                 if (online_analyze_verbose)
413                         startStamp = GetCurrentTimestamp();
414
415                 analyze_rel(relOid,
416 #if PG_VERSION_NUM < 90500
417                         &vacstmt
418 #if PG_VERSION_NUM >= 90018
419                         , true
420 #endif
421                         , GetAccessStrategy(BAS_VACUUM)
422 #if (PG_VERSION_NUM >= 90000) && (PG_VERSION_NUM < 90004)
423                         , true
424 #endif
425 #else
426                         NULL /*RangeVar*/, VACOPT_ANALYZE | ((online_analyze_verbose) ? VACOPT_VERBOSE : 0),
427                         &vacstmt, NULL, true, GetAccessStrategy(BAS_VACUUM)
428 #endif
429                 );
430
431                 if (online_analyze_verbose)
432                 {
433                         long    secs;
434                         int             microsecs;
435
436                         endStamp = GetCurrentTimestamp();
437                         TimestampDifference(startStamp, endStamp, &secs, &microsecs);
438                         elog(INFO, "analyze \"%s\" took %.02f seconds", 
439                                 get_rel_name(relOid), ((double)secs) + ((double)microsecs)/1.0e6);
440                 }
441
442
443                 if (tabentry == NULL)
444                 {
445                         /* new table */
446                         pgstat_clear_snapshot();
447                 }
448                 else
449                 {
450                         /* update last analyze timestamp in local memory of backend */
451                         tabentry->analyze_timestamp = now;
452                 }
453         }
454 #if PG_VERSION_NUM >= 90000
455         else if (tabentry != NULL)
456         {
457                 tabentry->changes_since_analyze += naffected;
458         }
459 #endif
460 }
461
462 extern PGDLLIMPORT void onlineAnalyzeHooker(QueryDesc *queryDesc);
463 void
464 onlineAnalyzeHooker(QueryDesc *queryDesc)
465 {
466         uint32  naffected = 0;
467
468         if (queryDesc->estate)
469                 naffected = queryDesc->estate->es_processed;
470
471         if (online_analyze_enable && queryDesc->plannedstmt &&
472                         (queryDesc->operation == CMD_INSERT ||
473                          queryDesc->operation == CMD_UPDATE ||
474                          queryDesc->operation == CMD_DELETE
475 #if PG_VERSION_NUM < 90200
476                          || (queryDesc->operation == CMD_SELECT && queryDesc->plannedstmt->intoClause)
477 #endif
478                          ))
479         {
480 #if PG_VERSION_NUM < 90200
481                 if (queryDesc->operation == CMD_SELECT)
482                 {
483                         Oid     relOid = RangeVarGetRelid(queryDesc->plannedstmt->intoClause->rel, true);
484
485                         makeAnalyze(relOid, queryDesc->operation, naffected);
486                 }
487                 else
488 #endif
489                 if (queryDesc->plannedstmt->resultRelations &&
490                                  queryDesc->plannedstmt->rtable)
491                 {
492                         ListCell        *l;
493
494                         foreach(l, queryDesc->plannedstmt->resultRelations)
495                         {
496                                 int                     n = lfirst_int(l);
497                                 RangeTblEntry   *rte = list_nth(queryDesc->plannedstmt->rtable, n-1);
498
499                                 if (rte->rtekind == RTE_RELATION)
500                                         makeAnalyze(rte->relid, queryDesc->operation, naffected);
501                         }
502                 }
503         }
504
505         if (oldExecutorEndHook)
506                 oldExecutorEndHook(queryDesc);
507         else
508                 standard_ExecutorEnd(queryDesc);
509 }
510
511 #if PG_VERSION_NUM >= 90200
512 static void
513 onlineAnalyzeHookerUtility(Node *parsetree, const char *queryString,
514 #if PG_VERSION_NUM >= 90300
515                                                         ProcessUtilityContext context, ParamListInfo params,
516 #else
517                                                         ParamListInfo params, bool isTopLevel,
518 #endif
519                                                         DestReceiver *dest, char *completionTag) {
520         RangeVar        *tblname = NULL;
521
522         if (IsA(parsetree, CreateTableAsStmt) && ((CreateTableAsStmt*)parsetree)->into)
523                 tblname = (RangeVar*)copyObject(((CreateTableAsStmt*)parsetree)->into->rel);
524
525         if (oldProcessUtilityHook)
526                 oldProcessUtilityHook(parsetree, queryString, 
527 #if PG_VERSION_NUM >= 90300
528                                                           context, params,
529 #else
530                                                           params, isTopLevel,
531 #endif
532                                                           dest, completionTag);
533         else
534                 standard_ProcessUtility(parsetree, queryString, 
535 #if PG_VERSION_NUM >= 90300
536                                                                 context, params,
537 #else
538                                                                 params, isTopLevel,
539 #endif
540                                                                 dest, completionTag);
541
542         if (tblname) {
543                 Oid     tblOid = RangeVarGetRelid(tblname, NoLock, true);
544
545                 makeAnalyze(tblOid, CMD_INSERT, 0); 
546         }
547 }
548 #endif
549
550 void _PG_init(void);
551 void
552 _PG_init(void)
553 {
554         oldExecutorEndHook = ExecutorEnd_hook;
555
556         ExecutorEnd_hook = onlineAnalyzeHooker;
557
558 #if PG_VERSION_NUM >= 90200
559         oldProcessUtilityHook = ProcessUtility_hook;
560
561         ProcessUtility_hook = onlineAnalyzeHookerUtility;
562 #endif
563
564
565         DefineCustomBoolVariable(
566                 "online_analyze.enable",
567                 "Enable on-line analyze",
568                 "Enables analyze of table directly after insert/update/delete/select into",
569                 &online_analyze_enable,
570 #if PG_VERSION_NUM >= 80400
571                 online_analyze_enable,
572 #endif
573                 PGC_USERSET,
574 #if PG_VERSION_NUM >= 80400
575                 GUC_NOT_IN_SAMPLE,
576 #if PG_VERSION_NUM >= 90100
577                 NULL,
578 #endif
579 #endif
580                 NULL,
581                 NULL
582         );
583
584         DefineCustomBoolVariable(
585                 "online_analyze.verbose",
586                 "Verbosity of on-line analyze",
587                 "Make ANALYZE VERBOSE after table's changes",
588                 &online_analyze_verbose,
589 #if PG_VERSION_NUM >= 80400
590                 online_analyze_verbose,
591 #endif
592                 PGC_USERSET,
593 #if PG_VERSION_NUM >= 80400
594                 GUC_NOT_IN_SAMPLE,
595 #if PG_VERSION_NUM >= 90100
596                 NULL,
597 #endif
598 #endif
599                 NULL,
600                 NULL
601         );
602
603     DefineCustomRealVariable(
604                 "online_analyze.scale_factor",
605                 "fraction of table size to start on-line analyze",
606                 "fraction of table size to start on-line analyze",
607                 &online_analyze_scale_factor,
608 #if PG_VERSION_NUM >= 80400
609                 online_analyze_scale_factor,
610 #endif
611                 0.0,
612                 1.0,
613                 PGC_USERSET,
614 #if PG_VERSION_NUM >= 80400
615                 GUC_NOT_IN_SAMPLE,
616 #if PG_VERSION_NUM >= 90100
617                 NULL,
618 #endif
619 #endif
620                 NULL,
621                 NULL
622         );
623
624     DefineCustomIntVariable(
625                 "online_analyze.threshold",
626                 "min number of row updates before on-line analyze",
627                 "min number of row updates before on-line analyze",
628                 &online_analyze_threshold,
629 #if PG_VERSION_NUM >= 80400
630                 online_analyze_threshold,
631 #endif
632                 0,
633                 0x7fffffff,
634                 PGC_USERSET,
635 #if PG_VERSION_NUM >= 80400
636                 GUC_NOT_IN_SAMPLE,
637 #if PG_VERSION_NUM >= 90100
638                 NULL,
639 #endif
640 #endif
641                 NULL,
642                 NULL
643         );
644
645     DefineCustomRealVariable(
646                 "online_analyze.min_interval",
647                 "minimum time interval between analyze call (in milliseconds)",
648                 "minimum time interval between analyze call (in milliseconds)",
649                 &online_analyze_min_interval,
650 #if PG_VERSION_NUM >= 80400
651                 online_analyze_min_interval,
652 #endif
653                 0.0,
654                 1e30,
655                 PGC_USERSET,
656 #if PG_VERSION_NUM >= 80400
657                 GUC_NOT_IN_SAMPLE,
658 #if PG_VERSION_NUM >= 90100
659                 NULL,
660 #endif
661 #endif
662                 NULL,
663                 NULL
664         );
665
666         DefineCustomEnumVariable(
667                 "online_analyze.table_type",
668                 "Type(s) of table for online analyze: all(default), persistent, temporary, none",
669                 NULL,
670                 &online_analyze_table_type,
671 #if PG_VERSION_NUM >= 80400
672                 online_analyze_table_type,
673 #endif
674                 online_analyze_table_type_options,
675                 PGC_USERSET,
676 #if PG_VERSION_NUM >= 80400
677         GUC_NOT_IN_SAMPLE,
678 #if PG_VERSION_NUM >= 90100
679                 NULL,
680 #endif
681 #endif
682                 NULL,
683                 NULL
684         );
685
686     DefineCustomStringVariable(
687                 "online_analyze.exclude_tables",
688                 "List of tables which will not online analyze",
689                 NULL,
690                 &excludeTables.tableStr,
691 #if PG_VERSION_NUM >= 80400
692                 "",
693 #endif
694                 PGC_USERSET,
695                 0,
696 #if PG_VERSION_NUM >= 90100
697                 excludeTablesCheck,
698                 excludeTablesAssign,
699 #else
700                 excludeTablesAssign,
701 #endif
702                 excludeTablesShow
703         );
704
705     DefineCustomStringVariable(
706                 "online_analyze.include_tables",
707                 "List of tables which will online analyze",
708                 NULL,
709                 &includeTables.tableStr,
710 #if PG_VERSION_NUM >= 80400
711                 "",
712 #endif
713                 PGC_USERSET,
714                 0,
715 #if PG_VERSION_NUM >= 90100
716                 includeTablesCheck,
717                 includeTablesAssign,
718 #else
719                 includeTablesAssign,
720 #endif
721                 includeTablesShow
722         );
723 }
724
725 void _PG_fini(void);
726 void
727 _PG_fini(void)
728 {
729         ExecutorEnd_hook = oldExecutorEndHook;
730 #if PG_VERSION_NUM >= 90200
731         ProcessUtility_hook = oldProcessUtilityHook;
732 #endif
733
734         if (excludeTables.tables)
735                 free(excludeTables.tables);
736         if (includeTables.tables)
737                 free(includeTables.tables);
738
739         excludeTables.tables = includeTables.tables = NULL;
740         excludeTables.nTables = includeTables.nTables = 0;
741 }