473,396 Members | 1,676 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

MySQL Substring Index Problem

Hello,

As much as I understand, MySql does not support indexes on substring selects. I have need a query like:

Expand|Select|Wrap|Line Numbers
  1.                     SELECT 
  2.                         DISTINCT C.CODE, 
  3.                         C.NAME
  4.                     FROM 
  5.                         mtt_table1 A,
  6.                         mtt_table2 B,
  7.                         mtt_table3 C,
  8.                         mtt_table4 D
  9.                     WHERE 1
  10.                         AND (C.NAME LIKE '%abc%' OR C.KEYWORDS LIKE '%abc%')
  11.                         AND ( SUBSTRING(B.GTIP,1,4) = A.GTIP or SUBSTRING(B.GTIP,1,6) = A.GTIP OR SUBSTRING(B.GTIP,1,8) = A.GTIP )
  12.                         AND C.CODE = B.CODE
  13.                         AND D.GTIP = A.GTIP
  14.  
How can I do it with indeses. I have billons of rows in the tables.

Thanks
Adnan
May 2 '10 #1
0 1952

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Duane Winner | last post by:
Hello all - I'm having a small problem with the mysql startup script that ships with MySQL-3.23.56-1. I'm running on RedHat Linux. It works fine, but I have a backup server that runs a script...
1
by: jy2003 | last post by:
INDEX index_A (coll_a, coll_b), INDEX index_B (col_b, coll_a), Are these two indexes redundant? The two indexes above actually contain the same contents in different order. I can change a query...
9
by: Sheldon | last post by:
Hi, I have a mysql setting problem that is driving me mad. Hopefully someone can give some advice: On the local network I have windows 2000/iis5 machine running our intranet site, with php...
0
by: Leif Wessman | last post by:
I have a very large table with book titles. How can I use Mysql to do a fulltext search that returns rows that only contains the words that the user searched for, ordered by relevance? Note, rows...
0
by: gw | last post by:
I am new to MySQL and my problem is with storing a datetime value in a table. I created a table with a column designated as DATETIME. I fill it with the NOW() function. No matter whether I...
1
by: Gregory.Spencer | last post by:
Hi there, Using PHPMyAdmin and it is very usefully reporting problems with my MySQL DB. "PRIMARY and INDEX keys should not both be set for column `column_name`" and
4
by: Jean-François Michaud | last post by:
Hello, I've been looking at this for a bit now and I don't see what's wrong with the code. Can anybody see a problem with this? Here is an XSLT snippet I use. <xsl:template match="graphic">...
1
by: cctham | last post by:
Hi, I have an issue with php and/or mysql. I have a php form that writes "items" to a mysql database, including a description of the item. I am testing it now by putting special characters in...
2
by: rocksoft | last post by:
Hi I am working in asp.net with C# web application, I have used visual studio 2003, i have used dropdownlist in my application to populate the data from mysql database, i have got problem while...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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,...
0
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...
0
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,...

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.