John,

As far as I'm aware there is no problem creating a multi-column unique index
on fields that have already been indexed seperately. The multi column index
will be used in situations where you are trying to find unique
_combinations_ of the two fields and the individual indexes in situations
where you are trying to find instances of one OR the other.

If you are doing a number of inserts or multi-row inserts you may want to
use the "IGNORE" parameter. This will allow the INSERT command to complete
and return successfully, simply skipping the rows where dupes are found,
otherwise mysql is going to generate a duplicate key error when duplicates
are found.

Hope this clarifies some things for you.

Lachlan

-----Original Message-----
From: John Mistler [mailto:[EMAIL PROTECTED]
Sent: Thursday, 8 July 2004 12:27 PM
To: [EMAIL PROTECTED]
Subject: Re: INSERT DISTINCT?


I am not certain from the documentation whether it is advisable to create a
unique multi-column index on two columns that are already individually
indexed.  The individual indexes I assume I need for when I do a SELECT on
those particular columns.  The multi-column one I need for the reasons
discussed below.  Any one know?

Thanks,

John

on 7/7/04 2:21 PM, Joshua J. Kugler at [EMAIL PROTECTED] wrote:

> Certainly, it's called making a unique index on the field(s) you want to
keep
> unique.
>
> Hope that helps.
>
> j----- k-----
>
> On Wednesday 07 July 2004 12:48 pm, John Mistler said something like:
>> Is there a way to do an INSERT on a table only if no row already exists
>> with the same info for one or more of the columns as the row to be
>> inserted? That is, without using a method outside SQL?
>>
>> Thanks,
>>
>> John


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]




-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to