# Composite primary key , any drawback?

**URL:** <https://forums.percona.com/t/composite-primary-key-any-drawback/639>\
**Category:** Other MySQL® Questions\
**Created:** [February 16, 2008, 6:49am UTC](https://forums.percona.com/t/composite-primary-key-any-drawback/639 "2008-02-16T06:49:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tantan](https://avatars.discourse-cdn.com/v4/letter/t/bb73d2/32.png) [@tantan](https://forums.percona.com/u/tantan)\
**Post date:** [February 16, 2008, 6:49am UTC](https://forums.percona.com/t/composite-primary-key-any-drawback/639/1 "2008-02-16T06:49:12Z")

</div>

Hi guys

I m now working with kind of webboard (community website).  
and i ve some questions here.

i ve a USER\_COMMENT table (innodb)  
assume 20% insert/update/delete, 80% select

USER\_ID (int)  
POSTER\_ID (int)  
POST\_TIME (int)  
MESSAGE (text)  
.  
.  
.  
and primary key (user\_id, post\_time, poster\_id) - it’s always unique by using these 3 columns  
example queries to be used  
(select from whrere user\_id = 111 order by post\_time)  
(delete whrere user\_id = 111 and post\_time = 111 and poster\_id = 112)  
(select from whrere user\_id = 111 and poster\_id = 112 order by post\_time)

1. is there any drawback using long Composite primary key instead of indexes? (some table use 5 columns(integer) as primary key)

2. if i add some additional indexes (secondary index) will it be slowdown by long composite primary key? (some articles here say -if you use long primary key, there will be some overhead on secondary index)

3. should i use a surrogate key(auto\_increment) in first column  
and use indexes or unique instead?

Many thx
