Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Suppose we are creating databases containing information about monkeys, and a user interface to present monkey information to users.

We have two separate databases. The schemas are identical (and are at least intended to remain so) but they are on different machines and have information on different monkeys. This is inconvenient but unavoidable.

The user interface we're building queries both databases and presents all the monkeys in the same filterable HTML table to the user.

What's the best approach to generating IDs for monkeys? Is it acceptable to prefix the ID according to which database the monkeys are in?

share|improve this question
    
Which database? Same LAN? Are you querying both databases in a live manner? In short, more detail, please! –  Max Vernon Oct 7 '13 at 3:03

2 Answers 2

up vote 2 down vote accepted

I'd consider composite PK instead of prefixing values in one column. It seems a bit more clear to me, and it should help avoiding potential problems if you switch to single server (or cluster) in the future (then this column can be used as partition key).

share|improve this answer

Does your ID have to be numeric? If not you could use a uniqueidentifier field.

http://en.wikipedia.org/wiki/Globally_unique_identifier

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.