# Primary key column ordering

**URL:** <https://forum.liquibase.org/t/primary-key-column-ordering/502>\
**Category:** General Discussion\
**Created:** [April 9, 2010, 8:16pm UTC](https://forum.liquibase.org/t/primary-key-column-ordering/502 "2010-04-09T20:16:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mgargano\_lb](https://avatars.discourse-cdn.com/v4/letter/m/a88e57/32.png) [@mgargano\_lb](https://forum.liquibase.org/u/mgargano_lb)\
**Post date:** [April 9, 2010, 8:16pm UTC](https://forum.liquibase.org/t/primary-key-column-ordering/502/1 "2010-04-09T20:16:00Z")

</div>

Is there a way to order the columns in a primary key?&nbsp; Looking at the DTD it doesn’t look like there is an attribute on the constraints tag to specify what order the columns go in when defining the PK in createTable.&nbsp; This is need for DB optimization and the creation of the proper indexes (is index creation implied in PK creation in liquibase?).

---

<div class="post-metadata">

**Author:** ![nvoxland](https://avatars.discourse-cdn.com/v4/letter/n/87869e/32.png) [@nvoxland](https://forum.liquibase.org/u/nvoxland)\
**Post date:** [April 9, 2010, 8:16pm UTC](https://forum.liquibase.org/t/primary-key-column-ordering/502/2 "2010-04-09T20:16:00Z")

</div>

They should be created in the same order that they are listed in the xml.&nbsp; We don’t automatically generate a create index statement with each primary key, we assume the database will create the necessary indexes.&nbsp;

If you do not get the control over PK syntax you need from the createTable change, you can always fall back to the tag.

Nathan
