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

Commit9ee5338

Browse files
committed
Improvement code readability.
1 parent8fa35de commit9ee5338

File tree

8 files changed

+33
-18
lines changed

8 files changed

+33
-18
lines changed

‎LICENSE‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2016-2018, Postgres Professional
1+
Copyright (c) 2016-2020, Postgres Professional
22

33
Permission to use, copy, modify, and distribute this software and its documentation for any purpose, without fee, and without a written agreement is hereby granted, provided that the above copyright notice and this paragraph and the following two paragraphs appear in all copies.
44

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ Dynamically generated constants are okay.
316316

317317
##License
318318

319-
©[Postgres Professional](https://postgrespro.com/), 2016-2018. Licensed under
319+
©[Postgres Professional](https://postgrespro.com/), 2016-2020. Licensed under
320320
[The PostgreSQL License](LICENSE).
321321

322322
##Reference

‎aqo.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,9 @@ _PG_init(void)
116116
parampathinfo_postinit_hook=ppi_hook;
117117

118118
init_deactivated_queries_storage();
119-
AQOMemoryContext=AllocSetContextCreate(TopMemoryContext,"AQOMemoryContext",ALLOCSET_DEFAULT_SIZES);
119+
AQOMemoryContext=AllocSetContextCreate(TopMemoryContext,
120+
"AQOMemoryContext",
121+
ALLOCSET_DEFAULT_SIZES);
120122
}
121123

122124
PG_FUNCTION_INFO_V1(invalidate_deactivated_queries_cache);

‎aqo.h‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
* Module storage.c is responsible for storage query settings and models
106106
* (i. e. all information which is used in extension).
107107
*
108-
* Copyright (c) 2016-2018, Postgres Professional
108+
* Copyright (c) 2016-2020, Postgres Professional
109109
*
110110
* IDENTIFICATION
111111
* contrib/aqo/aqo.h
@@ -267,8 +267,10 @@ extern void ppi_hook(ParamPathInfo *ppi);
267267
intget_query_hash(Query*parse,constchar*query_text);
268268
externintget_fss_for_object(List*clauselist,List*selectivities,
269269
List*relidslist,int*nfeatures,double**features);
270-
voidget_eclasses(List*clauselist,int*nargs,int**args_hash,int**eclass_hash);
271-
intget_clause_hash(Expr*clause,intnargs,int*args_hash,int*eclass_hash);
270+
voidget_eclasses(List*clauselist,int*nargs,
271+
int**args_hash,int**eclass_hash);
272+
intget_clause_hash(Expr*clause,intnargs,
273+
int*args_hash,int*eclass_hash);
272274

273275

274276
/* Storage interaction */

‎cardinality_estimation.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
* General method for prediction the cardinality of given relation.
1515
*/
1616
double
17-
predict_for_relation(List*restrict_clauses,List*selectivities,List*relids,int*fss_hash)
17+
predict_for_relation(List*restrict_clauses,List*selectivities,
18+
List*relids,int*fss_hash)
1819
{
1920
intnfeatures;
2021
double*matrix[aqo_K];

‎postprocessing.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,8 @@ learnOnPlanState(PlanState *p, void *context)
276276
(nodeTag(p->plan)==T_HashJoin||
277277
nodeTag(p->plan)==T_MergeJoin||
278278
nodeTag(p->plan)==T_NestLoop)))
279-
predicted=p->plan->plan_rows*get_parallel_divisor(p->plan->path_parallel_workers);
279+
predicted=p->plan->plan_rows*
280+
get_parallel_divisor(p->plan->path_parallel_workers);
280281
else
281282
predicted=p->plan->plan_rows;
282283

@@ -295,7 +296,8 @@ learnOnPlanState(PlanState *p, void *context)
295296

296297
/*
297298
* A subtree was not visited. In this case we can not teach AQO
298-
* because ntuples value is equal to 0 and we will got learn rows == 1.
299+
* because ntuples value is equal to 0 and we will got
300+
* learn rows == 1.
299301
* It is false teaching, because at another place of a plan
300302
* scanning of the node may produce many tuples.
301303
*/

‎preprocessing.c‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,9 @@ aqo_planner(Query *parse,
205205
}
206206
if (query_context.adding_query)
207207
{
208-
add_query(query_context.query_hash,query_context.learn_aqo,query_context.use_aqo,query_context.fspace_hash,query_context.auto_tuning);
208+
add_query(query_context.query_hash,query_context.learn_aqo,
209+
query_context.use_aqo,query_context.fspace_hash,
210+
query_context.auto_tuning);
209211
add_query_text(query_context.query_hash,query_text);
210212
}
211213
}
@@ -217,8 +219,11 @@ aqo_planner(Query *parse,
217219
query_context.fspace_hash=DatumGetInt32(query_params[3]);
218220
query_context.auto_tuning=DatumGetBool(query_params[4]);
219221
query_context.collect_stat=query_context.auto_tuning;
220-
if (!query_context.learn_aqo&& !query_context.use_aqo&& !query_context.auto_tuning)
222+
223+
if (!query_context.learn_aqo&& !query_context.use_aqo&&
224+
!query_context.auto_tuning)
221225
add_deactivated_query(query_context.query_hash);
226+
222227
if (RecoveryInProgress())
223228
{
224229
query_context.learn_aqo= false;
@@ -232,8 +237,8 @@ aqo_planner(Query *parse,
232237
query_context.auto_tuning= false;
233238
}
234239
}
235-
query_context.explain_aqo=query_context.use_aqo;
236240

241+
query_context.explain_aqo=query_context.use_aqo;
237242
returncall_default_planner(parse,cursorOptions,boundParams);
238243
}
239244

‎storage.c‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ update_query(int query_hash, bool learn_aqo, bool use_aqo,
224224

225225
index_rescan(query_index_scan,&key,1,NULL,0);
226226
slot=MakeSingleTupleTableSlot(query_index_scan->heapRelation->rd_att,
227-
&TTSOpsBufferHeapTuple);
227+
&TTSOpsBufferHeapTuple);
228228
find_ok=index_getnext_slot(query_index_scan,ForwardScanDirection,slot);
229229
Assert(find_ok);
230230
tuple=ExecFetchSlotHeapTuple(slot, true,&shouldFree);
@@ -414,7 +414,9 @@ load_fss(int fss_hash, int ncols, double **matrix, double *targets, int *rows)
414414
if (DatumGetInt32(values[2])==ncols)
415415
{
416416
if (ncols>0)
417-
/* The case than an object has not any filters, no selectivities. */
417+
/*
418+
* The case than an object has not any filters and selectivities
419+
*/
418420
deform_matrix(values[3],matrix);
419421

420422
deform_vector(values[4],targets,rows);
@@ -506,7 +508,7 @@ update_fss(int fss_hash, int nrows, int ncols, double **matrix, double *targets)
506508
index_rescan(data_index_scan,key,2,NULL,0);
507509

508510
slot=MakeSingleTupleTableSlot(data_index_scan->heapRelation->rd_att,
509-
&TTSOpsBufferHeapTuple);
511+
&TTSOpsBufferHeapTuple);
510512
find_ok=index_getnext_slot(data_index_scan,ForwardScanDirection,slot);
511513

512514
if (!find_ok)
@@ -635,7 +637,7 @@ get_aqo_stat(int query_hash)
635637
index_rescan(stat_index_scan,&key,1,NULL,0);
636638

637639
slot=MakeSingleTupleTableSlot(stat_index_scan->heapRelation->rd_att,
638-
&TTSOpsBufferHeapTuple);
640+
&TTSOpsBufferHeapTuple);
639641
find_ok=index_getnext_slot(stat_index_scan,ForwardScanDirection,slot);
640642

641643
if (find_ok)
@@ -760,9 +762,10 @@ update_aqo_stat(int query_hash, QueryStat *stat)
760762
{
761763
tuple=ExecFetchSlotHeapTuple(slot, true,&shouldFree);
762764
Assert(shouldFree!= true);
763-
values[0]=heap_getattr(tuple,1,RelationGetDescr(aqo_stat_heap),&isnull[0]);
765+
values[0]=heap_getattr(tuple,1,
766+
RelationGetDescr(aqo_stat_heap),&isnull[0]);
764767
nw_tuple=heap_modify_tuple(tuple,tuple_desc,
765-
values,isnull,replace);
768+
values,isnull,replace);
766769
if (my_simple_heap_update(aqo_stat_heap,&(nw_tuple->t_self),nw_tuple,
767770
&update_indexes))
768771
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp