I think a temporary table is likely to be the right approach. I have
some times found massive seed improvements by caching a result set
inside a temporary table.
If the data in the table is just ids (ie, just one field), you could get
an additional speed bump by rewriting your WHERE clause to use IN. For
example, if you have:
SELECT * FROM t JOIN tempTable ON t.someId = tempTable.id
You can rewrite that as:
SELECT * FROM t WHERE t.someId IN (SELECT * FROM tempTable)
MySQL can apply some extra optimizations to the IN clause (e.g. sort the
data and search for a match using a binary tree search).
Daniel.
Manoj Singh wrote:
Hi All,
I have a query which returns the large number of ids which i am using in
other queries. I am doing this in PHP. Now the first query can return
unlimited number of ids which might create problem in PHP. I want to store
this ids in MYSQL through temporary table so that i can access that ids in
other queries directly.
Do you think the approach is right or there is any other good approach?
Please suggest.
Regards,
Manoj
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php