I need to run multiple (lots of!) selects on a table (obviously simplified):
libraries_books
---------------
id
library_id
book_id
where I'll be looking for different book_id
's on the same library_id
.
Now, I'm aware of temporary tables:
SELECT id, book_id INTO TEMPORARY tmp_books where library_id=?
and then one can optionally add indexes on tmp_books
and run queries on it instead of libraries_books, but I've got a feeling there's an another way to achieve this in a more performant fashion. Is there?