On 04/12/2011 06:03 AM, tedd wrote:
In a simple purchase table that contains only the customer-id and purchased item-id would it be better to have an index of not?

1) If you're going to be searching or joining based on either of those columns (and you probably will be joining, at least), indexing the column will improve performance.

2) Having a unique ID per row will likely lessen your headaches down the road when it comes to deleting and/or updating records, and distinguishing between similar-but-separate records. Adding that ID column is worth it.

- A.

--
Allen Shaw
CEO and Lead Developer, NS Web Solutions

"Innovating for change"

[email protected]

_______________________________________________
New York PHP Community MySQL SIG
http://lists.nyphp.org/mailman/listinfo/mysql

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php

Reply via email to