In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
This section briefly explains why PostgreSQL NOT IN is sometimes fast and sometimes slow when it is executed.
The test data are as follows:
[local]: 5432 pg12@testdb=# select count (*) from tbl; count-1 (1 row) Time: 6.009 ms [local]: 5432 pg12@testdb=# select count (*) from t_big_null Count-10000001 (1 row) Time: 633.248 ms [local]: 5432 pg12@testdb=#\ d tbl Table "public.tbl" Column | Type | Collation | Nullable | Default-+-id | integer | | | not null | value | integer | | not null | Indexes: "tbl_pkey" PRIMARY KEY | Btree (id) Rules: rule_tbl_update AS ON INSERT TO tbl WHERE (EXISTS (SELECT tbl_1.id) Tbl_1.value FROM tbl tbl_1 WHERE tbl_1.id = new.id) DO INSTEAD UPDATE tbl SET value = tbl.value + 1 WHERE tbl.id = new.id [local]: 5432 pg12@testdb=#\ d t_big_null Table "public.t_big_null" Column | Type | Collation | Nullable | Default-+-- -+-id | integer | [local]: 5432 pg12@testdb=#
Note that the tbl table has only one row of data (id = 1), while the tweak _ null table is intentionally placed last when inserting the row "id = 1".
Truncate table into t_big_null select generate_series (2 million); insert into t_big_null values (1); data structure
SubPlanState
Run time status of subplan
/ *-* SubPlanState node *-* / typedef struct SubPlanState {NodeTag type; SubPlan * subplan; / * expression plan node * / struct PlanState * planstate; / * subselect plan's state tree * / struct PlanState * parent; / * parent plan node's state tree * / ExprState * testexpr / * combined expression status State of combining expression * / List * args; / * parameter expression status; states of argument _ expression (s) * / HeapTuple curTuple; / * the nearest tuple of subplan Copy of most recent tuple from subplan * / Datum curArray; / * most recent array from ARRAY () subplan * / / * these are used when hashing the subselect's output: * / TupleDesc descRight; / * projected subquery descriptor Subselect desc after projection * / ProjectionInfo * projLeft; / * for projecting lefthand exprs * / ProjectionInfo * projRight; / * for projecting subselect output * / TupleHashTable hashtable; / * hashtable for no-nulls subselect rows * / TupleHashTable hashnulls; / * hashtable for rows with null (s) * / bool havehashrows; / * true if hashtable is not empty * / bool havenullrows; / * true if hashnulls is not empty * / MemoryContext hashtablecxt / * memory context containing hash tables * / MemoryContext hashtempcxt; / * temp memory context for hash tables * / ExprContext * innerecontext; / * econtext for computing inner tuples * / AttrNumber * keyColIdx; / * control data for hash tables * / Oid * tab_eq_funcoids; / * equality funcoids for table * datatype (s) * / Oid * tab_collations / * collations for hash and comparison * / FmgrInfo * tab_hash_funcs; / * hash functions for table datatype (s) * / FmgrInfo * tab_eq_funcs; / * equality functions for table datatype (s) * / FmgrInfo * lhs_hash_funcs; / * hash functions for lefthand datatype (s) * / FmgrInfo * cur_eq_funcs; / * equality functions for LHS vs. Table * / ExprState * cur_eq_comp / * equality comparator for LHS vs. Table * /} SubPlanState
SubPlan
Subquery plan
/ * SubPlan-executable expression node for a subplan (sub-SELECT) * * The planner replaces SubLink nodes in expression trees with SubPlan * nodes after it has finished planning the subquery. SubPlan references * a sub-plantree stored in the subplans list of the toplevel PlannedStmt. * (We avoid a direct link to make it easier to copy expression trees * without causing multiple processing of the subplan.) * the query planner replaces the SubLink node in the expression tree with the SubPlan node after completing the planning of the subquery. * SubPlan refers to the sub-plantree stored in the subplans linked list in the high-level PlannedStmt. * (avoid using direct links, which makes copying expression trees relatively simple) * * In an ordinary subplan, testexpr points to an executable expression * (OpExpr, an AND/OR tree of OpExprs, or RowCompareExpr) for the combining * operator (s); the left-hand arguments are the original lefthand expressions, * and the right-hand arguments are PARAM_EXEC Param nodes representing the * outputs of the sub-select. (NOTE: runtime coercion functions may be * inserted as well.) This is just the same expression tree as testexpr in * the original SubLink node, but the PARAM_SUBLINK nodes are replaced by * suitably numbered PARAM_EXEC nodes. * normally, testexpr points to the executable expression (OpExpr, AND/OR tree of OpExprs, or RowCompareExpr) used for combining operations; * the left parameter is the original left expression, and the right parameter is the PARAM_EXEC parameter node used to represent the output of the subquery. * has the same expression tree as the testexpr of the original SubLink node, but the PARAM_SUBLINK node is replaced with the appropriate numbered PARAM_EXEC node. * * If the sub-select becomes an initplan rather than a subplan, the executable * expression is part of the outer plan's expression tree (and the SubPlan * node itself is not, but rather is found in the outer plan's initPlan * list). In this case testexpr is NULL to avoid duplication. * if the subquery becomes initplan instead of subplan, the executable expression is part of the outer plan expression tree. * in this case, testexpr is NULL to avoid repetition. * The planner also derives lists of the values that need to be passed into * and out of the subplan. Input values are represented as a list "args" of * expressions to be evaluated in the outer-query context (currently these * args are always just Vars, but in principle they could be any expression). * The values are assigned to the global PARAM_EXEC params indexed by parParam * (the parParam and args lists must have the same ordering). SetParam is a * list of the PARAM_EXEC params that are computed by the sub-select, if it * is an initplan; they are listed in order by sub-select output column * position. (parParam and setParam are integer Lists, not Bitmapsets, * because their ordering is significant.) * the planner also derives a linked list of values that need to be passed in and out of the subplan. * enter the "args" linked list of the value identification bit expression, which is parsed in the context of the outer query. * (these args are usually Vars, but in principle they can be arbitrary expressions) * these values assign values to the global PARAM_EXEC parameter with parParam as the index. * setParam is a linked list of PARAM_EXEC parameters, which is calculated by a subquery, such as initplan. * they are sorted and organized into linked lists according to the location of the output columns of the subquery. * (parParam and setParam are integer linked lists, not Bitmapsets linked lists) * * Also, the planner computes startup and per-call costs for use of the * SubPlan. Note that these include the cost of the subquery proper, * evaluation of the testexpr if any, and any hashtable management overhead. * at the same time, the planner calculates the cost of SubPlan startup and each call. Note: it includes the cost of parsing testexpr normally by subquery and the cost of hash table management. * / typedef struct SubPlan {Expr xpr;// expression / * Fields copied from original SubLink: * / / copied from SubLink SubLinkType subLinkType; / * see above * / * The combining operators, transformed to an executable expression: * / combined operator, converted to executable expression Node * testexpr; / * OpExpr or RowCompareExpr expression tree * / List * paramIds / * Parameter IDs;IDs of Params embedded in the above * / / * Identification of the Plan tree to use: * / Plan tree ID int plan_id; / * Index (from 1) in PlannedStmt.subplans * / / * Identification of the SubPlan for EXPLAIN and debugging purposes: * / EXPLAIN and SubPlan ID char * plan_name for debug purposes / * A name assigned during planning * / * Extra data useful for determining subplan's output type: * / additional information used to determine the subplan output type Oid firstColType; / * the first column type of the subplan result; Type of first column of subplan result * / int32 firstColTypmod; / * Typmod;Typmod of first column of subplan result * / Oid firstColCollation; / * first column Collation of the first column Collation of first column of subplan * result * / / * Information about execution strategy: * / related information about the execution phase bool useHashTable; / * whether to use hash tables to store the output of subqueries; true to store subselect output in a hash * table (implies we are doing "IN") * / bool unknownEqFalse / * T if OK, F if unknown; Fast processing of null values; true if it's okay to return FALSE when the * spec result is UNKNOWN; this allows much * simpler handling of null values * / bool parallel_safe / * is it secure in parallel? is the subplan parallel-safe? * / * Note: parallel_safe does not consider contents of testexpr or args * / / * Information for passing params into and out of the subselect: * / / Information used to pass in and out parameters to subqueries / * setParam and parParam are lists of integers (param IDs) * / / setParam and parParam are param IDs List * setParam / * initplan subqueries have to set these * Params for parent plan * / List * parParam; / * indices of input Params from parent plan * / List * args; / * expressions passed by parParam value Exprs to pass as parParam values * / * Estimated execution costs: * / / estimated execution cost Cost startup_cost; / * one-time setup cost * / Cost per_call_cost; / * cost for each subplan evaluation * /} SubPlan
SubLinkType
SubLink Typ
/ * SubLink * * A SubLink represents a subselect appearing in an expression, and in some * cases also the combining operator (s) just above it. The subLinkType * indicates the form of the expression represented: * EXISTS_SUBLINK EXISTS (SELECT...) * ALL_SUBLINK (lefthand) op ALL (SELECT...) * ANY_SUBLINK (lefthand) op ANY (SELECT..) * ROWCOMPARE_SUBLINK (lefthand) op (SELECT...) * EXPR_SUBLINK (SELECT with single targetlist item...) * MULTIEXPR_SUBLINK (SELECT with multiple targetlist items...) * ARRAY_SUBLINK ARRAY (SELECT with single targetlist item...) * CTE_SUBLINK WITH query (never actually part of an expression) * We use SubLink to represent subqueries that appear in expressions In some cases, the combination operator appears on top of SubLink. * subLinkType represents the form of the expression: * EXISTS_SUBLINK EXISTS (SELECT...) * ALL_SUBLINK (lefthand) op ALL (SELECT...) * ANY_SUBLINK (lefthand) op ANY (SELECT...) * ROWCOMPARE_SUBLINK (lefthand) op (SELECT...) * EXPR_SUBLINK (SELECT with single targetlist item...) * MULTIEXPR_SUBLINK (SELECT with multiple targetlist items...) * ARRAY_SUBLINK ARRAY (SELECT with single targetlist item...) * CTE_SUBLINK WITH query (never actually part of an expression) * * For ALL ANY, and ROWCOMPARE, the lefthand is a list of expressions of the * same length as the subselect's targetlist. ROWCOMPARE will * always* have * a list with more than one entry; if the subselect has just one target * then the parser will create an EXPR_SUBLINK instead (and any operator * above the subselect will be represented separately). * ROWCOMPARE, EXPR, and MULTIEXPR require the subselect to deliver at most * one row (if it returns no rows, the result is NULL). * ALL, ANY, and ROWCOMPARE require the combining operators to deliver boolean * results. ALL and ANY combine the per-row results using AND and OR * semantics respectively. * ARRAY requires just one target column, and creates an array of the target * column's type using any number of rows resulting from the subselect. * for ALL,ANY and ROWCOMPARE, the left operator is an expression linked list that is the same length as the target list of the subquery. * ROWCOMPARE usually has a linked list of more than one entry; if the subquery happens to have only one target column, the parser creates EXPR_SUBLINK * (and all operators above the subquery are represented separately) * ROWCOMPARE, EXPR, and MULTIEXPR require the subquery to output at least one row (if 0 rows are returned, the result is NULL). * ALL,ANY and ROWCOMPARE require a combination of operators to output Boolean results. * ALL/ANY uses AND/ OR semantics to combine the results of each row. * * SubLink is classed as an Expr node, but it is not actually executable; * it must be replaced in the expression tree by a SubPlan node during * planning. * SubLink is classified as an Expr node, but it is not actually executable and must be replaced by SubPlan during the planning phase. * * NOTE: in the raw output of gram.y, testexpr contains just the raw form * of the lefthand _ expression (if any), and operName is the String name of * the combining operator. Also, subselect is a raw parsetree. During parse * analysis, the parser transforms testexpr into a complete boolean expression * that compares the lefthand value (s) to PARAM_SUBLINK nodes representing the * output columns of the subselect. And subselect is transformed to a Query. * This is the representation seen in saved rules and in the rewriter. * Note: in the naked output of gram.y, testexpr contains only the naked form of the left expression, and operName is the string name of the combination operator. * at the same time, the subquery is naked parsetree. During parsing, the * parser converts the testexpr to a full Boolean expression to compare the left operator value with the subquery output column value represented by the PARAM_SUBLINK node. * the subquery is converted to a Query structure. * representations visible in stored rules and overrides. * * In EXISTS, EXPR, MULTIEXPR, and ARRAY SubLinks, testexpr and operName * are unused and are always null. * in EXISTS/EXPR/MULTEXPR/ARRAY SubLinks, testexpr and operName no longer use the usual null value. * subLinkId is currently used only for MULTIEXPR SubLinks, and is zero in * other SubLinks. This number identifies different multiple-assignment * subqueries within an UPDATE statement's SET list. It is unique only * within a particular targetlist. The output column (s) of the MULTIEXPR * are referenced by PARAM_MULTIEXPR Params appearing elsewhere in the tlist. * subLinkId is currently only used for MULTIEXPR, and the value is 0 in other SubLinks. * this number identifies multiple assigned subqueries that are different in the SET linked list of UPDATE statements. * it is unique only within a specific targetlist. * PARAM_MULTIEXPR parameters that appear elsewhere in tlist depend on the output column of MULTIEXPR. * The CTE_SUBLINK case never occurs in actual SubLink nodes, but it is used * in SubPlans generated for WITH subqueries. * CTE_SUBLINK does not appear in the actual SubLink node, but is used in the SubPlans generated by the with subquery. * / typedef enum SubLinkType {EXISTS_SUBLINK, ALL_SUBLINK, ANY_SUBLINK, ROWCOMPARE_SUBLINK, EXPR_SUBLINK, MULTIEXPR_SUBLINK, ARRAY_SUBLINK, CTE_SUBLINK / * is only used in SubPlans; for SubPlans only * /} SubLinkType
SubLink
SubLink structure
Typedef struct SubLink {Expr xpr; SubLinkType subLinkType; / * see above * / int subLinkId; / * ID (1.. n); 0 if not MULTIEXPR * / Node * testexpr; / * outer-query test for ALL/ANY/ROWCOMPARE * / List * operName; / * originally specified operator name * / Node * subselect / * subselect as Query* or raw parsetree * / int location; / * token location, or-1 if unknown * /} SubLink
MaterialState
Material statu
/ *-* MaterialState information * materialize nodes are used to materialize the results * of a subplan into a temporary file. * materialize node is used to materialize the result of subplan as a temporary file. * * ss.ss_ScanTupleSlot refers to output of underlying plan. * the output from ss.ss_ScanTupleSlot to underlyling plan (subplan) *-* / typedef struct MaterialState {ScanState ss; / * its first field is NodeTag * / int eflags; / * is passed to the capability tag of tuplestore; capability flags to pass to tuplestore * / bool eof_underlying; / * has reached the end of underlying plan? Reached end of underlying plan? * / Tuplestorestate * tuplestorestate;} MaterialState
Tuplestorestate
Private status of Tuplestore related operations.
/ * Possible states of a Tuplestore object. These denote the states that * persist between calls of Tuplestore routines. * / typedef enum {TSS_INMEM, / * Tuples still fit in memory * / TSS_WRITEFILE, / * Writing to temp file * / TSS_READFILE / * Reading from temp file * /} TupStoreStatus;/* * Private state of a Tuplestore operation. * / struct Tuplestorestate {TupStoreStatus status; / * status enumeration value Enumerated value as shown above * / int eflags; / * capability flags (OR of pointers' flags) * / bool backward; / * store extra length words in file? * / bool interXact; / * keep open through transactions? * / bool truncated; / * tuplestore_trim has removed tuples? * / int64 availMem / * remaining memory available, in bytes * / int64 allowedMem; / * total memory allowed, in bytes * / int64 tuples; / * number of tuples added * / BufFile * myfile; / * underlying file, or NULL if none * / MemoryContext context; / * memory context for holding tuples * / ResourceOwner resowner / * resowner for holding temp files * / * * These function pointers decouple the routines that must know what kind * of tuple we are handling from the routines that don't need to know it. * They are set up by the tuplestore_begin_xxx routines. * (Although tuplestore.c currently only supports heap tuples, I've copied * this part of tuplesort.c so that extension to other kinds of objects * will be easy if it's ever needed.) * * Function to copy a supplied input tuple into palloc'd space. (NB: we * assume that a single pfree () is enough to release the tuple later, so * the representation must be "flat" in one palloc chunk. State- > availMem * must be decreased by the amount of space used. * / void * (* copytup) (Tuplestorestate * state, void * tup); / * Function to write a stored tuple onto tape. The representation of the * tuple on tape need not be the same as it is in memory; requirements on * the tape representation are given below. After writing the tuple, * pfree () it, and increase state- > availMem by the amount of memory space * thereby released. * / void (* writetup) (Tuplestorestate * state, void * tup); / * Function to read a stored tuple from tape back into memory. 'len' is * the already-read length of the stored tuple. Create and return a * palloc'd copy, and decrease state- > availMem by the amount of memory * space consumed. * / void * (* readtup) (Tuplestorestate * state, unsigned int len); / * This array holds pointers to tuples in memory if we are in state INMEM. * In states WRITEFILE and READFILE it's not used. * * When memtupdeleted > 0, the first memtupdeleted pointers are already * released due to a tuplestore_trim () operation, but we haven't expended * the effort to slide the remaining pointers down. These unused pointers * are set to NULL to catch any invalid accesses. Note that memtupcount * includes the deleted pointers. * / void * * memtuples; / * array of pointers to palloc'd tuples * / int memtupdeleted; / * the first N slots are currently unused * / int memtupcount; / * number of tuples currently present * / int memtupsize; / * allocated length of memtuples array * / bool growmemtuples / * memtuples' growth still underway? * / * * These variables are used to keep track of the current positions. * * In state WRITEFILE, the current file seek position is the write point; * in state READFILE, the write position is remembered in writepos_xxx. * (The write position is the same as EOF, but since BufFileSeek doesn't * currently implement SEEK_END, we have to remember it explicitly.) * / TSReadPointer * readptrs; / * array of read pointers * / int activeptr; / * index of the active read pointer * / int readptrcount; / * number of pointers currently valid * / int readptrsize / * allocated length of readptrs array * / int writepos_file; / * file# (valid if READFILE state) * / off_t writepos_offset; / * offset (valid if READFILE state) * /} # define COPYTUP (state,tup) ((* (state)-> copytup) (state,tup)) # define WRITETUP (state,tup) ((* (state)-> writetup) (state,tup)) # define READTUP (state,len) ((* (state)-> readtup) (state,len)) # define LACKMEM (state) ((state)-> availMem
< 0)#define USEMEM(state,amt) ((state)-> < scanslot->Tts_nvalid); (gdb) 492 * op- > resvalue = scanslot- > tts_values [attnum]; (gdb) 493* op- > resnull = scanslot- > tts_isnull [attnum]; (gdb) 495EEO_NEXT (); (gdb) p * op- > resvalue$114 = 1 (gdb) n962 ExecEvalParamExec (state, op, econtext); (gdb) 964 EEO_NEXT () (gdb) p * op$115 = {opcode = 7224136, resvalue = 0x30698b8, resnull = 0x30698c0, d = {fetch = {last_var = 0, fixed = 23, known_desc = 0x0, kind = 0x0}, var = {attnum = 0, vartype = 23}, wholerow = {var = 0x1700000000, first = false, slow = false, tupdesc = 0x0, junkFilter = 0x0}, assign_var = {resultnum = 0, attnum = 23}, assign_tmp = {resultnum = 0}, constval = {value = 98784247808, isnull = isnull Func = {finfo = 0x1700000000, fcinfo_data = 0x0, fn_addr = 0x0, nargs = 0}, boolexpr = {anynull = 0x1700000000, jumpdone = 0}, qualexpr = {jumpdone = 0}, jump = {jumpdone = 0}, nulltest_row = {argdesc = 0x1700000000}, param = {paramid = 0, paramtype = 23}, cparam = {paramfunc = 0x1700000000, paramarg = 0x0, paramid = 0, paramtype = 0}, casetest = {value = 0x1700000000, isnull = 0x0}, make_readonly = {value = value Isnull = 0x0}, iocoerce = {finfo_out = 0x1700000000, fcinfo_data_out = 0x0, finfo_in = 0x0, fcinfo_data_in = 0x0}, sqlvaluefunction = {svf = 0x1700000000}, nextvalueexpr = {seqid = 0, seqtypid = 23}, arrayexpr = {elemvalues = 0x1700000000, elemnulls = 0x0, nelems = 0, elemtype = 0, elemlength = 0, elembyval = false, elemalign = 0'\ 000 miles, multidims = false}, arraycoerce = {elemexprstate = 0x1700000000, resultelemtype = 0, amstate = 0x0} Row = {tupdesc = 0x1700000000, elemvalues = 0x0, elemnulls = 0x0}, rowcompare_step = {finfo = 0x1700000000, fcinfo_data = 0x0, fn_addr = 0x0, jumpnull = 0, jumpdone = 0}, rowcompare_final = {rctype = 0}, minmax = {values = 0x1700000000, nulls = 0x0, nelems = 0, op = IS_GREATEST, finfo = 0x0, fcinfo_data = 0x0}, fieldselect = {fieldnum = 0, resulttype = 23, argdesc = 0x0}, fieldstore = {fieldstore = fstore, fstore = fstore Values = 0x0, nulls = 0x0, ncolumns = 0}, sbsref_subscript = {state = 0x1700000000, off = 0, isupper = false, jumpdone = 0}, sbsref = {state = 0x1700000000}, domaincheck = {constraintname = 0x1700000000, checkvalue = 0x0, checknull = 0x0, resulttype = 0}, convert_rowtype = {convert = 0x1700000000, indesc = 0x0, outdesc = 0x0, map = 0x0, initialized = false}, scalararrayop = {element_type = 0, element_type = 23, useOr = 0, useOr = useOr Typalign = 0'\ 000mm, finfo = 0x0, fcinfo_data = 0x0, fn_addr = 0x0}, xmlexpr = {xexpr = 0x1700000000, named_argvalue = 0x0, named_argnull = 0x0, argvalue = 0x0, argnull = 0x0}, aggref = {astate = 0x1700000000}, grouping_func = {parent = 0x1700000000, clauses = 0x0}, window_func = {wfstate = 0x1700000000}, subplan = {sstate = 0x1700000000}, alternative_subplan = {asstate = 0x1700000000}, agg_deserialize = {agg_deserialize = aggstate Fcinfo_data = 0x0, jumpnull = 0}, agg_strict_input_check = {args = 0x1700000000, nulls = 0x0, nargs = 0, jumpnull = 0}, agg_init_trans = {aggstate = 0x1700000000, pertrans = 0x0, aggcontext = 0x0, setno = 0, transno = 0, setoff = 0, jumpnull = 0}, agg_strict_trans_check = {aggstate = 0x1700000000, setno = 0, transno = 0, setoff = 0, jumpnull = 0}, agg_trans = {aggstate = 0x1700000000, pertrans = 0x0, aggcontext = 0x0 Setno = 0, transno = 0, setoff = 0}} (gdb) p * state$116 = {tag = {type = T_ExprState}, flags = 6'\ 006, resnull = false, resvalue = 0, resultslot = 0x0, steps = 0x3069418, evalfunc = 0x6e2d4d, expr = 0x30917a8, evalfunc_private = 0x6e2d4d, steps_len = 5, steps_alloc = 16, parent = 0x3068988, ext_params = 0x0, innermost_caseval = 0x0, innermost_casenull = 0x0, innermost_domainval = 0x0 Innermost_domainnull = 0x0} (gdb) n634 FunctionCallInfo fcinfo = op- > d.func.fcinfo_data (gdb) 635 NullableDatum * args = fcinfo- > args; (gdb) p * fcinfo$117 = {flinfo = 0x3069830, context = 0x0, resultinfo = 0x0, fncollation = 0, isnull = false, nargs = 2, args = 0x30698a8} (gdb) p * fcinfo- > args$118 = {value = 1, isnull = false} (gdb) n640 for (argno = 0; argno
< op->D.func.nargs Argno++) (gdb) p op- > d.func.nargs$119 = 2 (gdb) p * op$120 = {opcode = 7222440, resvalue = 0x3069388, resnull = 0x3069385, d = {fetch = {last_var = 50763824, fixed = false, known_desc = 0x3069888, kind = 0x96c2b2}, var = {attnum = 50763824, vartype = 0}, wholerow = {var = 0x3069830, first = 13636, slow = 152, tupdesc = 0x96c2b2, junkFilter = 0x2}, assign_var = {resultnum = 50763824, attnum = 0} Assign_tmp = {resultnum = 50763824}, constval = {value = 50763824, isnull = 136}, func = {finfo = 0x3069830, fcinfo_data = 0x3069888, fn_addr = 0x96c2b2, nargs = 2}, boolexpr = {anynull = 0x3069830, jumpdone = 50763912}, qualexpr = {jumpdone = 50763824}, jump = {jumpdone = 50763824}, nulltest_row = {argdesc = 0x3069830}, param = {paramid = 50763824, paramtype = 0}, cparam = {paramfunc = 0x3069830, paramarg = 0x3069888, paramid = 9880242 Paramtype = 0}, casetest = {value = 0x3069830, isnull = 0x3069888}, make_readonly = {value = 0x3069830, isnull = 0x3069888}, iocoerce = {finfo_out = 0x3069830, fcinfo_data_out = 0x3069888, finfo_in = 0x96c2b2, fcinfo_data_in = 0x2}, sqlvaluefunction = {svf = 0x3069830}, nextvalueexpr = {seqid = 50763824, seqtypid = 0}, arrayexpr = {elemvalues = 0x3069830, elemnulls = 0x3069888, nelems = 9880242, elemtype = 0, elemlength = 2, elembyval = false Elemalign = 0000000, multidims = false}, arraycoerce = {elemexprstate = 0x3069830, resultelemtype = 50763912, amstate = 0x96c2b2}, row = {tupdesc = 0x3069830, elemvalues = 0x3069888, elemnulls = 0x96c2b2}, rowcompare_step = {finfo = 0x3069830, fcinfo_data = 0x3069888, fn_addr = 0x96c2b2, jumpnull = 2, jumpdone = 0}, rowcompare_final = {rctype = 50763824}, minmax = {values = 0x3069830, nulls = 0x3069888, nelems = 9880242, op = IS_GREATEST, finfo = finfo Fcinfo_data = 0x0}, fieldselect = {fieldnum =-26576, resulttype = 0, argdesc = 0x3069888}, fieldstore = {fstore = 0x3069830, argdesc = 0x3069888, values = 0x96c2b2, nulls = 0x2, ncolumns = 0}, sbsref_subscript = {state = 0x3069830, off = 50763912, isupper = false, jumpdone = 9880242}, sbsref = {state = 0x3069830}, domaincheck = {constraintname = 0x3069830 "\ 262\ 302\ 226", checkvalue = 0x3069888, checknull = 0x96c2b2, resulttype = 2} Convert_rowtype = {convert = 0x3069830, indesc = 0x3069888, outdesc = 0x96c2b2, map = 0x2, initialized = false}, scalararrayop = {element_type = 50763824, useOr = false, typlen = 0, typbyval = 136, typalign =-104'\ 2303, finfo = 0x96c2b2, fcinfo_data = 0x2, fn_addr = 0x0}, xmlexpr = {xexpr = 0x3069830, named_argvalue = 0x3069888, named_argnull = 0x96c2b2, argvalue = 0x2, argnull = 0x0}, aggref = {astate = aggref} Grouping_func = {parent = 0x3069830, clauses = 0x3069888}, window_func = {wfstate = 0x3069830}, subplan = {sstate = 0x3069830}, alternative_subplan = {asstate = 0x3069830}, agg_deserialize = {aggstate = 0x3069830, fcinfo_data = 0x3069888, jumpnull = 9880242}, agg_strict_input_check = {args = 0x3069830, nulls = 0x3069888, nargs = 9880242, jumpnull = 0}, agg_init_trans = {aggstate = 0x3069830, pertrans = 0x3069888, aggcontext = 0x96c2b2, setno = 2, transno = 0 Setoff = 0, jumpnull = 0}, agg_strict_trans_check = {aggstate = 0x3069830, setno = 50763912, transno = 0, setoff = 9880242, jumpnull = 0}, agg_trans = {aggstate = 0x3069830, pertrans = 0x3069888, aggcontext = 0x96c2b2, setno = 2, transno = 0, setoff = 0}} (gdb) p op- > d-> func$121 = {finfo = 0x3069830, fcinfo_data = 0x3069888, fn_addr = 0x96c2b2 Nargs = 2} (gdb) p op- > d-> func- > finfo$122 = (FmgrInfo *) 0x3069830 (gdb) p * op- > d-> func- > finfo$123 = {fn_addr = 0x96c2b2, fn_oid = 65, fn_nargs = 2, fn_strict = true, fn_retset = false, fn_stats = 2'\ 002, fn_extra = 0x0, fn_mcxt = 0x3067da0, fn_expr = 0x30917a8} (gdb) p * op- > d-> func- > fcinfo_data$124 = {flinfo = 0x3069830, context = 0x0, resultinfo = 0x0, 0x0 = 0 Isnull = false, nargs = 2, args = 0x30698a8} (gdb) p * op- > d-> func- > fcinfo_data- > flinfo$125 = {fn_addr = 0x96c2b2, fn_oid = 65, fn_nargs = 2, fn_strict = true, fn_retset = false, fn_stats = 2'\ 002, fn_extra = 0x0, fn_mcxt = 0x3067da0, fn_expr = 0x30917a8} (gdb) p * op- > d-> func- > fcinfo_data- > args$126 = {value = 1 Isnull = false} (gdb) n642 if (args [argno] .isnull) (gdb) 640 for (argno = 0) Argno
< op->D.func.nargs; argno++) (gdb) 642 if (args [argno] .isnull) (gdb) 640 for (argno = 0; argno)
< op->D.func.narks; argno++) (gdb) 648 fcinfo- > isnull = false; (gdb) p * args$127 = {value = 1, isnull = false} (gdb) n649d = op- > d.func.fn_addr (fcinfo); (gdb) 650 * op- > resvalue = d; (gdb) pdong128 = 0 (gdb) n651 * op- > resnull = fcinfo- > isnull; (gdb) 654 EEO_NEXT () (gdb) 425 goto out; (gdb) n1747 * isnull = state- > resnull; (gdb) 1748 return state- > resvalue (gdb) p * state$129 = {tag = {type = T_ExprState}, flags = 6'\ 006, resnull = false, resvalue = 0, resultslot = 0x0, steps = 0x3069418, evalfunc = 0x6e2d4d, expr = 0x30917a8, evalfunc_private = 0x6e2d4d, steps_len = 5, steps_alloc = 16, parent = 0x3068988, ext_params = 0x0, innermost_caseval = 0x0, innermost_casenull = 0x0, innermost_domainval = 0x0, innermost_domainnull = 0x0} (gdb) n1749} (gdb) ExecEvalExprSwitchContext IsNull=0x7ffd184750ef) at.. / src/include/executor/executor.h:308308 MemoryContextSwitchTo (oldContext) (gdb) 309 return retDatum; (gdb) p retDatum$130 = 0 (gdb) n310} (gdb)
This is the 1760th call
ExecScanSubPlan (node=0x3069268, econtext=0x3068aa0, isNull=0x3068dbd) at nodeSubplan.c:410410 if (subLinkType = = ANY_SUBLINK) (gdb) 413 if (rownull) (gdb) 415 else if (DatumGetBool (rowresult)) (gdb) p rowresult$131 = 0 (gdb) n326 slot = ExecProcNode (planstate)) (gdb) 324 for (slot = ExecProcNode (planstate); (gdb) 325! TupIsNull (slot) (gdb) Breakpoint 17, ExecScanSubPlan (node=0x3069268, econtext=0x3068aa0, isNull=0x3068dbd) at nodeSubplan.c:328328 TupleDesc tdesc = slot- > tts_tupleDescriptor; (gdb) 334 if (subLinkType = = EXISTS_SUBLINK) (gdb) 341 if (subLinkType = = EXPR_SUBLINK) (gdb) 367 if (subLinkType = = ARRAY_SUBLINK) (gdb) 383 if (subLinkType = = ROWCOMPARE_SUBLINK & & found) (gdb) 388 found = true (gdb) 395 col = 1; (gdb) p * slot- > tts_values$132 = 10000000-> Last data (gdb) n396 foreach (plst, subplan- > paramIds) (gdb) 398 int paramid = lfirst_int (plst); (gdb) 401 prmdata = & (econtext- > ecxt_param_exec_ values [parallels]); (gdb) 402 Assert (prmdata- > execPlan = NULL) (gdb) p * prmdata$133 = {execPlan = 0x0, value = 10000000, isnull = false} (gdb) n403 prmdata- > value = slot_getattr (slot, col, & (prmdata- > isnull)); (gdb) 404 col++ (gdb) p * prmdata$134 = {execPlan = 0x0, value = 1, isnull = false}-- > this data The value is 1 (gdb) info bNum Type Disp Enb Address What17 breakpoint keep y 0x00000000007303b9 in ExecScanSubPlan at nodeSubplan.c:328 breakpoint already hit 1760 times (gdb) n396 foreach (plst, subplan- > paramIds) (gdb) 407 rowresult = ExecEvalExprSwitchContext (node- > testexpr, econtext (gdb) 410 if (subLinkType = = ANY_SUBLINK) (gdb) 413 if (rownull) (gdb) 415 else if (DatumGetBool (rowresult)) (gdb) 417 result = BoolGetDatum (true) (gdb) 418 * isNull = false; (gdb) 419 break; / * needn't look at any more rows * / (gdb) 442MemoryContextSwitchTo (oldcontext); (gdb) 444 if (subLinkType = = ARRAY_SUBLINK) (gdb) 449 else if (! found) (gdb) 464 return result; (gdb) (gdb) p result$135 = 1-> satisfy the condition
DONE
IV. Reference materials
N/A
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.