[Asterisk-code-review] alembic/sqlalchemy: auto increment only allowed on a single ... (asterisk[master])

George Joseph asteriskteam at digium.com
Wed Aug 10 08:04:43 CDT 2016


George Joseph has posted comments on this change.

Change subject: alembic/sqlalchemy: auto increment only allowed on a single column
......................................................................


Patch Set 3: Code-Review-1

(1 comment)

https://gerrit.asterisk.org/#/c/3436/3/contrib/ast-db-manage/config/versions/581a4264e537_adding_extensions.py
File contrib/ast-db-manage/config/versions/581a4264e537_adding_extensions.py:

PS3, Line 37:         sa.Column('id', sa.BigInteger, primary_key=True, nullable=False,
            :                   unique=True, autoincrement=True),
            :   
Having id be both unique and part of the primary key creates a unique index on id, but also makes id the first column in the secondary index, which makes the secondary index useless.  If you drop primary_key from id, then we get better indexing:

CREATE UNIQUE INDEX extensions_id_key
	ON public.extensions USING btree (id int8_ops);

PRIMARY KEY(context,exten,priority)


-- 
To view, visit https://gerrit.asterisk.org/3436
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ib9c712c612a4d7ec1edb0dcb77f1bae0905a470b
Gerrit-PatchSet: 3
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-HasComments: Yes



More information about the asterisk-code-review mailing list