Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8fa35de

Browse files
committed
Change the AQO patch for commit d90f594aea of PostgreSQL master branch. Made compiler quiet with -O3 cflag.
1 parent6a5a389 commit8fa35de

File tree

5 files changed

+28
-26
lines changed

5 files changed

+28
-26
lines changed

‎Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ DATA_built = aqo--1.1.sql
2222

2323
MODULE_big = aqo
2424
ifdefUSE_PGXS
25-
PG_CONFIG = pg_config
25+
PG_CONFIG?= pg_config
2626
PGXS :=$(shell$(PG_CONFIG) --pgxs)
2727
include$(PGXS)
2828
else

‎machine_learning.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ OkNNr_learn(int nrows, int nfeatures, double **matrix, double *targets,
155155
* replace data for the neighbor to avoid some fluctuations.
156156
* We will change it's row with linear smoothing by learning_rate.
157157
*/
158-
if (nrows!=0&&distances[mid]<object_selection_threshold)
158+
if (nrows>0&&distances[mid]<object_selection_threshold)
159159
{
160160
for (j=0;j<nfeatures;++j)
161161
matrix[mid][j]+=learning_rate* (features[j]-matrix[mid][j]);

‎postprocessing.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ learnOnPlanState(PlanState *p, void *context)
233233
p->plan->path_clauses!=NIL))
234234
{
235235
doublelearn_rows=0.;
236-
doublepredicted;
236+
doublepredicted=0.;
237237

238238
InstrEndLoop(p->instrument);
239239
if (p->instrument->nloops>0.)

‎preprocessing.c‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,14 @@ aqo_planner(Query *parse,
163163
break;
164164
caseAQO_MODE_CONTROLLED:
165165
caseAQO_MODE_FIXED:
166-
/* if query is not in AQO database than disable AQO for this query */
166+
/*
167+
* if query is not in the AQO knowledge base than disable AQO
168+
* for this query.
169+
*/
167170
query_context.adding_query= false;
168171
query_context.learn_aqo= false;
169172
query_context.use_aqo= false;
173+
query_context.auto_tuning= false;
170174
query_context.collect_stat= false;
171175
break;
172176
caseAQO_MODE_LEARN:
@@ -181,9 +185,7 @@ aqo_planner(Query *parse,
181185
/* Should never happen */
182186
break;
183187
default:
184-
elog(WARNING,
185-
"unrecognized mode in AQO: %d",
186-
aqo_mode);
188+
elog(WARNING,"unrecognized mode in AQO: %d",aqo_mode);
187189
break;
188190
}
189191
if (RecoveryInProgress())
@@ -275,10 +277,10 @@ isQueryUsingSystemRelation_walker(Node *node, void *context)
275277

276278
if (rte->rtekind==RTE_RELATION)
277279
{
278-
Relationrel=heap_open(rte->relid,AccessShareLock);
280+
Relationrel=table_open(rte->relid,AccessShareLock);
279281
boolis_catalog=IsCatalogRelation(rel);
280282

281-
heap_close(rel,AccessShareLock);
283+
table_close(rel,AccessShareLock);
282284
if (is_catalog)
283285
return true;
284286
}

‎storage.c‎

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ find_query(int query_hash,
7070
}
7171

7272
aqo_queries_table_rv=makeRangeVar("public","aqo_queries",-1);
73-
aqo_queries_heap=heap_openrv(aqo_queries_table_rv,lockmode);
73+
aqo_queries_heap=table_openrv(aqo_queries_table_rv,lockmode);
7474

7575
query_index_rel=index_open(query_index_rel_oid,lockmode);
7676
query_index_scan=index_beginscan(aqo_queries_heap,
@@ -102,7 +102,7 @@ find_query(int query_hash,
102102
ExecDropSingleTupleTableSlot(slot);
103103
index_endscan(query_index_scan);
104104
index_close(query_index_rel,lockmode);
105-
heap_close(aqo_queries_heap,lockmode);
105+
table_close(aqo_queries_heap,lockmode);
106106

107107
returnfind_ok;
108108
}
@@ -142,7 +142,7 @@ add_query(int query_hash, bool learn_aqo, bool use_aqo,
142142
query_index_rel=index_open(query_index_rel_oid,lockmode);
143143

144144
aqo_queries_table_rv=makeRangeVar("public","aqo_queries",-1);
145-
aqo_queries_heap=heap_openrv(aqo_queries_table_rv,lockmode);
145+
aqo_queries_heap=table_openrv(aqo_queries_table_rv,lockmode);
146146

147147
tuple=heap_form_tuple(RelationGetDescr(aqo_queries_heap),
148148
values,nulls);
@@ -167,7 +167,7 @@ add_query(int query_hash, bool learn_aqo, bool use_aqo,
167167
PG_END_TRY();
168168

169169
index_close(query_index_rel,lockmode);
170-
heap_close(aqo_queries_heap,lockmode);
170+
table_close(aqo_queries_heap,lockmode);
171171

172172
CommandCounterIncrement();
173173

@@ -207,7 +207,7 @@ update_query(int query_hash, bool learn_aqo, bool use_aqo,
207207
}
208208

209209
aqo_queries_table_rv=makeRangeVar("public","aqo_queries",-1);
210-
aqo_queries_heap=heap_openrv(aqo_queries_table_rv,lockmode);
210+
aqo_queries_heap=table_openrv(aqo_queries_table_rv,lockmode);
211211

212212
query_index_rel=index_open(query_index_rel_oid,lockmode);
213213
query_index_scan=index_beginscan(aqo_queries_heap,
@@ -261,7 +261,7 @@ update_query(int query_hash, bool learn_aqo, bool use_aqo,
261261
ExecDropSingleTupleTableSlot(slot);
262262
index_endscan(query_index_scan);
263263
index_close(query_index_rel,lockmode);
264-
heap_close(aqo_queries_heap,lockmode);
264+
table_close(aqo_queries_heap,lockmode);
265265

266266
CommandCounterIncrement();
267267

@@ -301,7 +301,7 @@ add_query_text(int query_hash, const char *query_text)
301301
aqo_query_texts_table_rv=makeRangeVar("public",
302302
"aqo_query_texts",
303303
-1);
304-
aqo_query_texts_heap=heap_openrv(aqo_query_texts_table_rv,
304+
aqo_query_texts_heap=table_openrv(aqo_query_texts_table_rv,
305305
lockmode);
306306

307307
tuple=heap_form_tuple(RelationGetDescr(aqo_query_texts_heap),
@@ -321,13 +321,13 @@ add_query_text(int query_hash, const char *query_text)
321321
CommandCounterIncrement();
322322
simple_heap_delete(aqo_query_texts_heap,&(tuple->t_self));
323323
index_close(query_index_rel,lockmode);
324-
heap_close(aqo_query_texts_heap,lockmode);
324+
table_close(aqo_query_texts_heap,lockmode);
325325
PG_RE_THROW();
326326
}
327327
PG_END_TRY();
328328

329329
index_close(query_index_rel,lockmode);
330-
heap_close(aqo_query_texts_heap,lockmode);
330+
table_close(aqo_query_texts_heap,lockmode);
331331

332332
CommandCounterIncrement();
333333

@@ -378,7 +378,7 @@ load_fss(int fss_hash, int ncols, double **matrix, double *targets, int *rows)
378378
}
379379

380380
aqo_data_table_rv=makeRangeVar("public","aqo_data",-1);
381-
aqo_data_heap=heap_openrv(aqo_data_table_rv,lockmode);
381+
aqo_data_heap=table_openrv(aqo_data_table_rv,lockmode);
382382

383383
data_index_rel=index_open(data_index_rel_oid,lockmode);
384384
data_index_scan=index_beginscan(aqo_data_heap,
@@ -434,7 +434,7 @@ load_fss(int fss_hash, int ncols, double **matrix, double *targets, int *rows)
434434
ExecDropSingleTupleTableSlot(slot);
435435
index_endscan(data_index_scan);
436436
index_close(data_index_rel,lockmode);
437-
heap_close(aqo_data_heap,lockmode);
437+
table_close(aqo_data_heap,lockmode);
438438

439439
returnsuccess;
440440
}
@@ -480,7 +480,7 @@ update_fss(int fss_hash, int nrows, int ncols, double **matrix, double *targets)
480480
}
481481

482482
aqo_data_table_rv=makeRangeVar("public","aqo_data",-1);
483-
aqo_data_heap=heap_openrv(aqo_data_table_rv,lockmode);
483+
aqo_data_heap=table_openrv(aqo_data_table_rv,lockmode);
484484

485485
tuple_desc=RelationGetDescr(aqo_data_heap);
486486

@@ -573,7 +573,7 @@ update_fss(int fss_hash, int nrows, int ncols, double **matrix, double *targets)
573573
ExecDropSingleTupleTableSlot(slot);
574574
index_endscan(data_index_scan);
575575
index_close(data_index_rel,lockmode);
576-
heap_close(aqo_data_heap,lockmode);
576+
table_close(aqo_data_heap,lockmode);
577577

578578
CommandCounterIncrement();
579579

@@ -617,7 +617,7 @@ get_aqo_stat(int query_hash)
617617
}
618618

619619
aqo_stat_table_rv=makeRangeVar("public","aqo_query_stat",-1);
620-
aqo_stat_heap=heap_openrv(aqo_stat_table_rv,heap_lock);
620+
aqo_stat_heap=table_openrv(aqo_stat_table_rv,heap_lock);
621621

622622
stat_index_rel=index_open(stat_index_rel_oid,index_lock);
623623
stat_index_scan=index_beginscan(aqo_stat_heap,
@@ -658,7 +658,7 @@ get_aqo_stat(int query_hash)
658658
ExecDropSingleTupleTableSlot(slot);
659659
index_endscan(stat_index_scan);
660660
index_close(stat_index_rel,index_lock);
661-
heap_close(aqo_stat_heap,heap_lock);
661+
table_close(aqo_stat_heap,heap_lock);
662662

663663
returnstat;
664664
}
@@ -704,7 +704,7 @@ update_aqo_stat(int query_hash, QueryStat *stat)
704704
}
705705

706706
aqo_stat_table_rv=makeRangeVar("public","aqo_query_stat",-1);
707-
aqo_stat_heap=heap_openrv(aqo_stat_table_rv,lockmode);
707+
aqo_stat_heap=table_openrv(aqo_stat_table_rv,lockmode);
708708

709709
tuple_desc=RelationGetDescr(aqo_stat_heap);
710710

@@ -787,7 +787,7 @@ update_aqo_stat(int query_hash, QueryStat *stat)
787787
ExecDropSingleTupleTableSlot(slot);
788788
index_endscan(stat_index_scan);
789789
index_close(stat_index_rel,lockmode);
790-
heap_close(aqo_stat_heap,lockmode);
790+
table_close(aqo_stat_heap,lockmode);
791791

792792
CommandCounterIncrement();
793793
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp