in reply to Perl and MySQL woes
If that's the case, it's possible that the rephrasing suggested by McDarren might save the day, if it allows the query conditions to be tested against the values in the index, rather than the values in the table itself.
But in case that doesn't pan out, it becomes a question of how to specify the query for those 100's of specific values in a more sensible way (i.e. not just making a list of 100's of values conjoined with "OR"). One possible solution would be to create a temporary table (just one column is needed), load it with the target values, and set the query to something like:
Don't forget to drop (or at least clear) the temp table when you're done. And bear in mind that you would need to be very careful if this is being done as part of a web app. (You don't want different clients using the same temp table, and you don't want too many clients creating lots of big temp tables at the same time...)SELECT sum(numlog) FROM table1 WHERE date IN (SELECT date from temptab +le)
You are using a current version of MySQL, aren't you? The ability to do a sub-query select statement like that has been around since the transition to version 5.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Perl and MySQL woes
by kyle (Abbot) on Jan 13, 2008 at 13:32 UTC |