A UNIQUE constraint is implemented in terms of a UNIQUE index anyway. The difference is that you can DROP INDEX but cannot DROP CONSTRAINT.
-----Urspr?ngliche Nachricht----- Von: Michele Pradella [mailto:michele.pradella at selea.com] Gesendet: Freitag, 17. Juli 2015 08:14 An: sqlite-users at mailinglists.sqlite.org Betreff: [sqlite] best way to have a constraint over 2 fields Hi all, I have a question about the best way to have a constrain on a table. think to a DB with 2 fields in the table ColA and ColB and you don't want to have multiple records with the same ColA,ColB couple so we can CONSTRAINT ColA_ColB UNIQUE (ColA,ColB) in the create table or CREATE UNIQUE INDEX uq_ColA_ColB ON table(ColA, ColB) which one do you think is better in terms of performance? keep in mind the table have millions of records and SELECT is the most frequent operation -- Selea s.r.l. Michele Pradella R&D SELEA s.r.l. Via Aldo Moro 69 Italy - 46019 Cicognara (MN) Tel +39 0375 889091 Fax +39 0375 889080 *michele.pradella at selea.com* <mailto:michele.pradella at selea.com> *http://www.selea.com* _______________________________________________ sqlite-users mailing list sqlite-users at mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users ___________________________________________ Gunter Hick Software Engineer Scientific Games International GmbH FN 157284 a, HG Wien Klitschgasse 2-4, A-1130 Vienna, Austria Tel: +43 1 80100 0 E-Mail: hick at scigames.at This communication (including any attachments) is intended for the use of the intended recipient(s) only and may contain information that is confidential, privileged or legally protected. Any unauthorized use or dissemination of this communication is strictly prohibited. If you have received this communication in error, please immediately notify the sender by return e-mail message and delete all copies of the original communication. Thank you for your cooperation.