Index or procedure

This is a discussion on Index or procedure within the MySQL Database forums, part of the Database Forums category; Hello, I need to check out if a description is already present in a table while inserting or updating. I ...


Go Back   Usenet Forums > Database Forums > MySQL Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 10-17-2007
Marco Cotroneo
 
Posts: n/a
Default Index or procedure

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
Reply With Quote
  #2 (permalink)  
Old 10-17-2007
Rik Wasmus
 
Posts: n/a
Default Re: Index or procedure

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
Reply With Quote
  #3 (permalink)  
Old 10-18-2007
Marco Cotroneo
 
Posts: n/a
Default Re: Index or procedure

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. :-)
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 05:23 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0