Re: WIP: Covering + unique indexes.
Anastasia Lubennikova <a.lubennikova@postgrespro.ru>
Attachments
- include_columns_10.0_v3.patch (text/x-patch) patch v3
26.02.2017 06:09, Amit Kapila:
> On Thu, Feb 16, 2017 at 6:43 PM, Anastasia Lubennikova
> <a.lubennikova@postgrespro.ru> wrote:
>> 14.02.2017 15:46, Amit Kapila:
>>
>>
>>> 4.
>>> + IDENTITY_P IF_P ILIKE IMMEDIATE IMMUTABLE IMPLICIT_P IMPORT_P IN_P
>>> INCLUDE
>>> INCLUDING INCREMENT INDEX INDEXES INHERIT INHERITS INITIALLY INLINE_P
>>> INNER_P INOUT INPUT_P INSENSITIVE INSERT INSTEAD INT_P INTEGER
>>> INTERSECT INTERVAL INTO INVOKER IS ISNULL ISOLATION
>>> @@ -3431,17 +3433,18 @@ ConstraintElem:
>>> n->initially_valid = !n->skip_validation;
>>> $$ = (Node *)n;
>>> }
>>> - | UNIQUE '(' columnList ')' opt_definition OptConsTableSpace
>>> + | UNIQUE '(' columnList ')' opt_c_including opt_definition
>>> OptConsTableSpace
>>>
>>> If we want to use INCLUDE in syntax, then it might be better to keep
>>> the naming reflect the same. For ex. instead of opt_c_including we
>>> should use opt_c_include.
>>>
>> Thank you for this suggestion. I've just wrote the code looking at examples
>> around,
>> but optincluding and optcincluding clauses seem to be redundant.
>> I've cleaned up the code.
>>
> I think you have cleaned only in gram.y as I could see the references
> to 'including' in other parts of code. For ex, see below code:
> @@ -2667,6 +2667,7 @@ _copyConstraint(const Constraint *from)
> COPY_NODE_FIELD(raw_expr);
> COPY_STRING_FIELD(cooked_expr);
> COPY_NODE_FIELD(keys);
> + COPY_NODE_FIELD(including);
> COPY_NODE_FIELD(exclusions);
> COPY_NODE_FIELD(options);
> COPY_STRING_FIELD(indexname);
> @@ -3187,6 +3188,7 @@ _copyIndexStmt(const IndexStmt *from)
> COPY_STRING_FIELD(accessMethod);
> COPY_STRING_FIELD(tableSpace);
> COPY_NODE_FIELD(indexParams);
> + COPY_NODE_FIELD(indexIncludingParams);
>
There is a lot of variables like 'including*' in the patch.
Frankly, I don't see a reason to rename them. It's clear that they
refers to included attributes, whatever we call them "include",
"included" or "including".
> @@ -425,6 +425,13 @@ ConstructTupleDescriptor(Relation heapRelation,
> /*
> + * Code below is concerned to the opclasses which are not used
> + * with the included columns.
> + */
> + if (i >= indexInfo->ii_NumIndexKeyAttrs)
> + continue;
> +
>
> There seems to be code below the above check which is not directly
> related to opclasses, so not sure if you have missed that or is there
> any other reason to ignore that. I am referring to following code in
> the same function after the above check:
> /*
> * If a key type different from the heap value is specified, update
> *
> the type-related fields in the index tupdesc.
> */
> if (OidIsValid(keyType) &&
> keyType != to->atttypid)
>
Good point,
I skip some steps that should be executed for all attributes.
It is harmless though, since for btree (and other access methods, except
hash) amkeytype is always invalid.
But I agree that the code can be clarified.
New patch with minor changes is attached.
--
Anastasia Lubennikova
Postgres Professional:http://www.postgrespro.com
The Russian Postgres Company
Commits
-
Adjust INCLUDE index truncation comments and code.
- 075aade4361b 11.0 landed
-
Add commentary explaining why MaxIndexTuplesPerPage calculation is safe.
- 2a67d6440db4 11.0 cited
-
Indexes with INCLUDE columns and their support in B-tree
- 8224de4f42cc 11.0 landed
-
Add amcheck verification of heap relations belonging to btree indexes.
- 7f563c09f890 11.0 cited
-
Doc: move info for btree opclass implementors into main documentation.
- 3785f7eee3d9 11.0 cited
-
Doc: mention that you can't PREPARE TRANSACTION after NOTIFY.
- e4fbf22831c2 11.0 cited
-
Remove dedicated B-tree root-split record types.
- 0c504a80cf2e 11.0 cited
-
Restructure index access method API to hide most of it at the C level.
- 65c5fcd353a8 9.6.0 cited
-
Split _bt_insertonpg to two functions.
- bc292937ae6a 8.3.0 cited
-
Major overhaul of btree index code. Eliminate special BTP_CHAIN logic for
- 9e85183bfc31 7.1.1 cited