Page 1 of 1

speed query or fetch the results

Posted: Thu Oct 20, 2005 3:56 am
by sebs
I have a problem with the speed query and with the speed of the load af the page.I have a search engine with 2GB database so you can see my problem is real big.I have read many things but nothing helped that much.Explain select doesn't help me.The query looks like:
[SQL]
select name,.... from firme where ...(('$name'='')or(Name REGEXP '[[:<:]]".$name."[[:>:]]')or(Name='$name'))...
[SQL]
In the select after where I have 6 conditions like the one above after other fields.Explain select doesn't help me.Any ideas of how I can speed the query or the fetch of the results in MYSQL?
Is there a way to show the first results of the page and the page to continue loading after that?

Posted: Thu Oct 20, 2005 7:48 am
by sebs
ok,I have another question and I don't want to open a new topic.Is there a way to sort a database?I don't want to use the sql query "order by" because it takes to much time.I want to have the database sorted whe I use the sql query.

Posted: Thu Oct 20, 2005 8:09 am
by feyd
read the manual's optimization chapter(s)

"order by" is the only way to sort a result set prior to it being given back to php.

Posted: Thu Oct 20, 2005 8:38 am
by sebs
feyd wrote:read the manual's optimization chapter(s)

"order by" is the only way to sort a result set prior to it being given back to php.
Yes but is there a way to sort the database before using it?