Please take our Survey
logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

Re: Re: slowness around 3.4.1 and custom fields?: msg#00112

bug-tracking.request-tracker.devel

Subject: Re: Re: slowness around 3.4.1 and custom fields?


On Fri, 25 Mar 2005 01:58:13 -0500 (EST)
>
> SELECT COUNT(DISTINCT main.id)
> FROM Tickets main , Transactions Transactions_1, Attachments Attachments_2
> WHERE ((Transactions_1.ObjectType = 'RT::Ticket'))
> AND ((main.EffectiveId = main.id))
> AND ((main.Status != 'deleted'))
> AND ((main.Type = 'ticket'))
> AND ( (
> (Attachments_2.Content LIKE '%customer%')
> AND(Attachments_2.TransactionId = Transactions_1.id)
> AND(main.id = Transactions_1.ObjectId)
> )
> OR(main.Subject LIKE '%customer%'));
>
> > the slow logs say it took 30 minutes to run.
>
> Eeep.
>
> This one is harder to fix, and I don't have the right shaped database
> to test on. The LIKEs on Content and Subject are *very* expensive...
>
> CREATE INDEX Transactions2 ON Transactions ( ObjectType, id );
> but I don't think it'll help much (or at all)
It won't because of the '%' in front of the part you want to search on.
It will your index search and most of not all databases will revert to
full table scans hence the 30min runtime.
Oracle has the same problem and I cheated on two fronts to get out of
this kind of problems:
- I use the full text search capabilities of Oracle
- hacked the searchbuilder part where the '%' are pre and post pended to
the query string.

I told my people to use explicit '%' when they want to search with
wildcards AND told them that if they search on Content AND use a
wildcard in front of their search that they are gone wait a bit and that
their collegues would get no more coffee for them ;-)

So the way to go for mysql is to use full text indices.

If anyone is interested in what I have done for Oracle I could make a
patch, which is not general, I don't know how to check if the dbh is an
Oracle connection or not. If this is possible then the patch should work
for anybody whether you're using Oracle or not.

Joop

--
Joop van de Wege <JoopvandeWege@xxxxxxxxx>


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
drivers.mtd/200...    security.firewa...    java.openamf.cv...    rpm.yum/2003-08...    telephony.sipp....    file-systems.oc...    qnx.openqnx.dev...    voip.linphone.u...    hardware.sony/2...    network.simulat...    boot-loaders.gr...    ietf.usenet.for...    culture.languag...    emacs.latex.pre...    music.jamiroqua...    xfree86.neomagi...    user-groups.lin...    ltp/2006-08/msg...    kde.kst/2005-08...    programming.too...    os.freebsd.deve...    window-managers...    audio.cd-record...    gnu.fiasco.bugs...   
Home | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe

Navigation