If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > indexing a long string

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-21-07, 08:37
ozzii ozzii is offline
Registered User
 
Join Date: Mar 2007
Posts: 194
indexing a long string

I have a varchar column 1000 characters in length but am unable to create an index on it. also i need to make this column unique aswell. does a fulltext index allow me to make this column unique aswell?If so whats the syntax?
Reply With Quote
  #2 (permalink)  
Old 05-21-07, 08:47
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
fulltext indexes are not unique-able

try declaring your (normal) index on only a portion of the column
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 05-21-07, 11:14
ozzii ozzii is offline
Registered User
 
Join Date: Mar 2007
Posts: 194
Quote:
Originally Posted by r937
fulltext indexes are not unique-able

try declaring your (normal) index on only a portion of the column
whats the max number of characters i can index?
whats the the syntax to declare the above (portion of column) and to make it unique? Please note the entire string needs to be unique not just a portion of it.

e.g. I have the following:

pd_name varchar(1000)
Reply With Quote
  #4 (permalink)  
Old 05-21-07, 11:27
aschk aschk is offline
Registered User
 
Join Date: Mar 2007
Location: 636f6d7075746572
Posts: 770
How about you check out the MySQL documentation to find out
Reply With Quote
  #5 (permalink)  
Old 05-21-07, 11:29
aschk aschk is offline
Registered User
 
Join Date: Mar 2007
Location: 636f6d7075746572
Posts: 770
Incidently, what is this column? What's in it? What does it represent? Why does it need to be 1000 varchars long?
Reply With Quote
  #6 (permalink)  
Old 05-21-07, 11:31
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
and why would uniqueness need to be determined down to the 1000th character? surely if two values are different, they will be different in the first X characters...
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #7 (permalink)  
Old 05-21-07, 12:00
ozzii ozzii is offline
Registered User
 
Join Date: Mar 2007
Posts: 194
Quote:
Originally Posted by r937
and why would uniqueness need to be determined down to the 1000th character? surely if two values are different, they will be different in the first X characters...
not for the data am storing in it! The column contains smiles strings these are string notation of a molecular structure and can be the same even up to the 999th character.

how would you determine uniqueness on this?
Reply With Quote
  #8 (permalink)  
Old 05-21-07, 12:10
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
Quote:
Originally Posted by ozzii
how would you determine uniqueness on this?
me? i would break it up into several columns based on codons or telomeres, and define a single UNIQUE index on those columns

alternatively, i would upgrade to at least 4.1.2, because in that release, index prefixes can be as large as 1000 bytes

__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
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 On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On