Click here to get back home

index by END of string, not beginning of string

 HomeNewsGroups | Search | About
 mailing.database.mysql    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
index by END of string, not beginning of string dt 08-29-2006
Get Chitika Premium
Posted by dt on August 29, 2006, 7:01 pm
Please log in for more thread options
My understand is that MYSQL only supports indexes on the beginning of a
string of data.

for example, if you have a list of email addresses, searching for
something like '%@yahoo.com' would need to do a full table scan.

why doesn't mysql offer a feature where it indexes by the END of the
string, so we can do these types of searches efficiently?

an index for email addresses of length 3 would only contain the last 3
chars, but it would still be a useful index type.

dave


Posted by Bill Karwin on August 30, 2006, 1:35 am
Please log in for more thread options
dt wrote:
> why doesn't mysql offer a feature where it indexes by the END of the
> string, so we can do these types of searches efficiently?

Probably the same answer as for any other "why don't they offer feature
X?" The answer is, "great idea! we'll do it when it comes to the top of
the priority list."

By the way, what you're describing could be achieved with current MySQL:
create a second column, copying the string to it using the REVERSE()
function, and then indexing that column.

Another extension to MySQL could be to allow us to create indexes based
on an expression, like REVERSE(colname), and then any expression in a
query that uses that exact syntax could make use of the index. This is
called "expression indexes" and it's an implementation feature in some
other RDBMS products (e.g. Firebird).

Regards,
Bill K.

Similar ThreadsPosted
how to get " into a string without it terminating it April 27, 2006, 2:56 pm
please help with mysql query string June 4, 2005, 5:31 am
NULL and zero-length string March 4, 2006, 5:09 am
Evaluting STRING expression as SQL May 31, 2006, 10:16 am
string comparisons with case October 4, 2006, 1:17 pm
Sounds like search for string in the database December 9, 2005, 6:56 am
Append a string to all the values in a column SQL January 13, 2006, 11:44 am
Append a string to all the values in a column SQL January 13, 2006, 12:01 pm
String Comparison (ORDER BY) with _ (underscore) February 27, 2006, 11:47 am
replace function and string comparison June 8, 2006, 4:17 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap