PHP - MYSQL query execution time

I have a question for you. I have this database with 250.000 recordings, with 2 text fields each containing up to 300 words. And I want do select all the data that meets some criteria and put it in another table. I thought to delete those recording that are not satisfying my condition with this wuery:

DELETE FROM `cables` WHERE 
`data` NOT LIKE "%BRV%" AND
`data` NOT LIKE "%Venezuela%" AND
`data` NOT LIKE "%Caracas%" AND
`data` NOT LIKE "%Hugo Chavez%" AND
`tags` NOT LIKE "%BRV%" AND
`tags` NOT LIKE "%Venezuela%" AND
`tags` NOT LIKE "%Caracas%" AND
`tags` NOT LIKE "%Hugo Chavez%" AND
`header` NOT LIKE "%BRV%" AND
`header` NOT LIKE "%Venezuela%" AND
`header` NOT LIKE "%Caracas%" AND
`header` NOT LIKE "%Hugo Chavez%" AND
`subject` NOT LIKE "%BRV%" AND
`subject` NOT LIKE "%Venezuela%" AND
`subject` NOT LIKE "%Caracas%" AND
`subject` NOT LIKE "%Hugo Chavez%" AND
`tmp` NOT LIKE "%BRV%" AND
`tmp` NOT LIKE "%Venezuela%" AND
`tmp` NOT LIKE "%Caracas%" AND
`tmp` NOT LIKE "%Hugo Chavez%" AND
`identifier` NOT LIKE "%BRV%" AND
`identifier` NOT LIKE "%Venezuela%" AND
`identifier` NOT LIKE "%Caracas%" AND
`identifier` NOT LIKE "%Hugo Chavez%"

Each row is OK if it containt at least one time any of those words. The thing is that I already have 3 hours since it is being in execution, and nothing hapened. I've stopped the proccess and nothing happened. The final resuls should have somewhere around 14000 recordings, What can I do? Thank you!!!!

This question and answers originated from www.stackoverflow.com
Question by (9/4/2011 8:21:09 PM)

Answer

The problem is that LIKE %text% will not make use of a fulltext index. So a big table with 250.000 entries and a lot of LIKE %% criterias will take an awful long time.

Are you sure you need the leading '%...'? Otherwise you can try to use Boolean search modifier.

Answer by

Find More Answers
Related Topics  php  mysql  phpmyadmin
Related Questions
  • MySql query execution time

    I am using MySQL Workbench on Windows. How do I find out the time taken to execute a query like Select * from employers where employerid > 200 Is there a statement I can enter that returns…
  • mysql query execution time | reduce query

    I have a query which let me to change users order. here is my query: update test set orderID = case orderID when (select orderID from ( select * from test where orderID > ( select …
  • Anyway to Limit MySQL Query Execution time?

    Hi I'm having issues on my server at the minute because some of the MySQL queries are taking a very long time to run, and hogging the resources on the server. I'm already in the process of optimi…
  • How to controll Mysql query execution time?

    I have several EVENTS executing every two seconds, I would like to kill those which are running longer than 1 second. Are there way to control query execution time on MySQL 5.5? cheers Arman.…
  • Strange mysql query execution time behavior

    hello i'm having a strange execution time behavior over almost same sql queries q1: SELECT `t1`.`id`, `t1`.`key`, `t1`.`module`, `t2`.`value` FROM `translates` AS `t1` LEFT JOIN `translates_…
  • MySQL Query: Epoch Time Filter

    I am having issues with my php script. I was wondering whether anyone knows how to set-up a filter when doing a MySQL query. My current query is the following: SELECT * FROM places WHERE location…
  • mysql query execution time - can i get this in milliseconds?

    I'm comparing a few different approaches to getting some data in mysql, directly at the console, using the SQL_NO_CACHE option to make sure mysql keeps running the full query every time. Mysql gives…
  • MySQl Query Execution Plan

    Does MySQL optimizer changes the execution plan based on the WHERE condition ? If I add one extra column for the comparison in WHERE condition , does it affect query execution plan ? Thanks, S…
  • mysql execution time

    Is there a way to get the execution time of the last executed query in mysql?
  • Mysql Slow query execution

    I have one procedure which retrieves all the records from one table which has more than 20000 records and two columns. the column i m trying to retrieve has the index on it. But still it takes mo…