|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hello,
I need to check out if a description is already present in a table while inserting or updating. I am wondering whether use an index on that description or check it in the trigger after/begin insert/update. Thanks for any advice Marco |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
On Wed, 17 Oct 2007 09:38:42 +0200, Marco Cotroneo <m.cot@italia.it> wrote:
> Hello, > I need to check out if a description is already present in a table > while inserting or updating. I am wondering whether use an index on that > description or check it in the trigger after/begin insert/update. It depends on the cicumstances. Having a reasonably 'small' description which should be enforced unique in a table would be best served with keys. Longer blobs with text I wouldn't make a key of, and just check wether it exists before a transaction. A UNIQUE Key, and using an 'INSERT .... ON DUPLICATE KEY UPDATE ..' syntax often does wonders. -- Rik Wasmus |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
Rik Wasmus ha scritto:
> On Wed, 17 Oct 2007 09:38:42 +0200, Marco Cotroneo <m.cot@italia.it> wrote: > >> Hello, >> I need to check out if a description is already present in a table >> while inserting or updating. I am wondering whether use an index on >> that description or check it in the trigger after/begin insert/update. > > It depends on the cicumstances. Having a reasonably 'small' description > which should be enforced unique in a table would be best served with > keys. Longer blobs with text I wouldn't make a key of, and just check > wether it exists before a transaction. > > A UNIQUE Key, and using an 'INSERT .... ON DUPLICATE KEY UPDATE ..' > syntax often does wonders. Thanks for your replay. :-) |
|
![]() |
| Outils de la discussion | |
|
|