473,564 Members | 2,798 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

index by END of string, not beginning of string

dt
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

Aug 29 '06 #1
1 4545
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.
Aug 30 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
1826
by: Mike Edey | last post by:
Good day. Recently I'd run into wishing a list's index method would match substrings. Being fairly new to this game I can't help but think that my solution is a little, well, clumsy. In the following trivial example I'm only interested in finding the first matching list item: >>> data = foo = >>> >>> ) > -1]] for >>> ix in...
9
2127
by: kosh | last post by:
I was wondering if there is or there could be some way to pass a generator an optional starting index so that if it supported that slicing could be made more efficient. Right now if you do use a generator and do a or any other kind of slice it reads all the values up to 100 also. I know a lot of generators have to do all previous parts...
10
3670
by: Andrew Dalke | last post by:
Is there an author index for the new version of the Python cookbook? As a contributor I got my comp version delivered today and my ego wanted some gratification. I couldn't find my entries. Andrew dalke@dalkescientific.com
17
6171
by: Dima Tkach | last post by:
Hi, everybody! I just ran into a weird problem on 7.3.4. Here is a simple testcase: rapidb=# create table nametab (name text); CREATE TABLE rapidb=# create index name_idx on nametab(name); CREATE INDEX rapidb=# set enable_seqscan=false;
4
5729
by: marc.gibian | last post by:
I have been trying to improve the quality of my C# and ADO.NET coding. One of the books I've read strongly advises against using string values to address individual values in DataRow objects. This rings true to me after years of avoiding string lookups whenever possible. But, when I attempted to implement this recommendation I appear to run...
2
5484
by: FBergemann | last post by:
if i compile following sample: #include <iostream> #include <string> int main(int argc, char **argv) { std::string test = "hallo9811111z"; std::string::size_type ret;
3
17916
by: Madmartigan | last post by:
Hello I have the following task but am battling with the final output. How do I keep two different vectors in sync and how would I retrieve the index for the maximum value of one of the vectors?? (using Dev-C++ compiler) Please see task and attempt below: TASK : 1.8.1 Exercise 1A - Temperature tracker Write a program that tracks...
3
1308
by: Robert Bevington | last post by:
Hi all, I ran into memory problems while tying to search and replace a very large text file. To solve this I break the file up into chunks and run the search and replace on each chunk. This works fine and has solved the OutOfMemory problem. However, on the last loop when the array c is written to CleanTMX, a number of 0x00 characters are...
5
1361
by: jehugaleahsa | last post by:
Hello: I have an input string that is supposed to follow a particular syntax. I am making a simple parser. In doing so, I need to write a lexical analyzer. I have decided to implement it in terms of regular expressions. I want to take a list of regular expressions and iterate over them, finding the first one that matches. Of course, it...
0
7583
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7888
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7642
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7950
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6255
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5484
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3643
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
924
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.