What about
SELECT id FROM table WHERE ok=1 AND type=1 and field like '%text'.

MySQL would have chance to create a temp table, reduce its contents via
ok=1 AND type=1 and then do the expensive like '%text%' matches...

Just my $0.02,
Guus

>  -----Original Message-----
>  From: Osus [mailto:[EMAIL PROTECTED]]
>  Sent: Wednesday, August 22, 2001 4:17 PM
>  To: [EMAIL PROTECTED]
>  Subject: Re: slow querys
>  
>  
>  Hi,
>  
>  The slow queries are those like...
>  
>  SELECT id FROM table WHERE field like '%text%' AND ok=1 AND type=1
>  
>  where table have about 20.000 records and field is a text field.
>  I need to find ALL the records  that have "text", even if 
>  text is "a" i have
>  to find all the records that have one "a".
>  
>  Many of that querys take 16 or 20 seconds.
>  
>  what do you think?
>  
>  
>  
>  ----- Original Message -----
>  From: "Jeremy Zawodny" <[EMAIL PROTECTED]>
>  To: "Jesus" <[EMAIL PROTECTED]>
>  Cc: <[EMAIL PROTECTED]>
>  Sent: Wednesday, August 22, 2001 12:08 AM
>  Subject: Re: slow querys
>  
>  
>  > On Tue, Aug 21, 2001 at 10:04:58PM +0200, Jesus wrote:
>  > > Threads: 12  Questions: 107446  Slow queries: 485  
>  Opens: 88  Flush
>  tables: 1
>  > >  Open tables: 82 Queries per second avg: 42.722
>  > > --------------
>  > >
>  > > Why have I so many slow querys???
>  > > I can't understand, but the performance get down.
>  > >
>  > > I have Mysql/apache/php
>  > > it's a web aplication
>  > >
>  > > what can i do?
>  >
>  > Enable the slow_query_log as described in the manual.  Use the
>  > information there to determine which queries are slow.
>  >
>  > Jeremy
>  > --
>  > Jeremy D. Zawodny, <[EMAIL PROTECTED]>
>  > Technical Yahoo - Yahoo Finance
>  > Desk: (408) 349-7878   Fax: (408) 349-5454   Cell: (408) 685-5936
>  >
>  > MySQL 3.23.41-max: up 4 days, processed 56,743,183 queries 
>  (142/sec. avg)
>  >
>  > 
>  ---------------------------------------------------------------------
>  > Before posting, please check:
>  >    http://www.mysql.com/manual.php   (the manual)
>  >    http://lists.mysql.com/           (the list archive)
>  >
>  > To request this thread, e-mail <[EMAIL PROTECTED]>
>  > To unsubscribe, e-mail
>  <[EMAIL PROTECTED]>
>  > Trouble unsubscribing? Try: 
>  http://lists.mysql.com/php/unsubscribe.php
>  >
>  >
>  
>  
>  ---------------------------------------------------------------------
>  Before posting, please check:
>     http://www.mysql.com/manual.php   (the manual)
>     http://lists.mysql.com/           (the list archive)
>  
>  To request this thread, e-mail <[EMAIL PROTECTED]>
>  To unsubscribe, e-mail 
>  <[EMAIL PROTECTED]>
>  Trouble unsubscribing? Try: 
>  http://lists.mysql.com/php/unsubscribe.php
>  

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to