473,386 Members | 1,647 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,386 software developers and data experts.

Sppeding up on ORed coloumns query

------=_NextPart_000_009E_01C36135.F4E3B2F0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi

While using OR in the query, Mysql doesn't use indexes.. right? Hence =
takes more time.

If queries have to be ORed on various coloumns (demand of the =
application) what one can do to speed it up.
Table structure:

CREATE TABLE npg_search (
sno int(11) NOT NULL auto_increment,
fileid varchar(255) NOT NULL,
caption text,
headline varchar(255),
specialins varchar(255),
keywords varchar(255) NOT NULL,
cat varchar(50) NOT NULL,
byline varchar(255),
credit varchar(255),
source varchar(255),
date date,
city varchar(100),
state varchar(100),
country varchar(100) NOT NULL,
orgtransref varchar(100),
copyright varchar(255),
extratxt text,
prints tinyint(4),
extrastr varchar(255),
bylinetitle varchar(255),
addedon timestamp(14),
PRIMARY KEY (sno),
INDEX (fileid, keywords, cat, country));

As shown columns fileid,keywords,cat and country are indexed (not the =
composite indexed).

Query is:

Select * from table where keywords like '%blah%' or caption like =
'%blah%' or headline like '%blah%' or cat like '%blah%' limit 20,10
Note: I can not use keywords like 'blah%' it has to be '%blah%' only... =
(i.e balh can be even middle part of the words)

Table contains 50,000 records and queries taking 7 sec which is =
unbelievable.

Mysql version: 3.23.52

Please suggest me some solution for this.
Thanks in advance

Binay

------=_NextPart_000_009E_01C36135.F4E3B2F0--
Jul 19 '05 #1
0 1023

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

Similar topics

2
by: lawrence | last post by:
A very strange bug. www.monkeyclaus.org is run by a cms I'm developing. One of types of users we allow is "justTestingTheSite", a type of user I developed to give demo's to prospective clients. The...
4
by: Wm | last post by:
I have a query that I expect to return 3 or 4 entries -- but I seem to be getting only the most recent entry, repeated 4 times. What am I doing wrong here? $query="SELECT...
0
by: Phil Powell | last post by:
I have a very simple mySqlQuery object that takes two parameters: 1) the string query 2) the db connection resource I tested and was certain everything is passing correctly (the string query...
8
by: Polar | last post by:
I am having troubles finding the parse error in this script. I've been checking for weeks. I am too new to the subject I guess. I am trying to show a readord and them have a form at the bottom...
3
by: Harvey | last post by:
Hi, I try to write an asp query form that lets client search any text-string and display all pages in my web server that contain the text. I have IIS 6.0 on a server 2003. The MSDN site says...
1
by: jaffar | last post by:
hi, i am developing an appllication, in this appllication i am using datagrid . in this datagrid coloumns header text i want to change coloumn header text in vertically it means datagrid...
1
by: suryar | last post by:
Great help if some one help me I have a excel file with 18 coloumns, I want to read all the coloumns in vb scrip and want to display in note pad
0
by: prakashamnkl | last post by:
i want to split the data grid coloumns into a sub header. And one more thing I want to insert the trackbar into the datagrid cells . Anybody have answers for my question plz reply me.
4
by: shashankpatwardhan | last post by:
I have a table tbl_tmp1 There are two fields EmpId EmpName I have another table tbl_Heads in this table ther are total 8 records I want to add number of coloumns equal to the row count...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...

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.