| re: LEFT JOIN problem
Firstly, to get any useful help from a forum like this, post the structure of your tables. You can post the results of a "SHOW CREATE TABLE xxx" statement where xxx is substituted by your table name.
To get an idea of what kind of work MySQL needs to perform in a query, use the EXPLAIN syntax. You just add the word "EXPLAIN" to the front of your query. MySQL will not perform the query, but will tell you what it thinks it needs to do. Interpreting the outcome of the EXPLAIN is something that takes some understanding, though. The EXPLAIN will show you, for example, which indexes are being used, and how many rows in each table need to be examined. You certainly do not want to have all rows in all tables examined. You can try to add an index, run the EXPLAIN, see the effect, then try a different index, etc. etc.
By the way, you say that your LEFT JOIN is performing in 12 seconds and that is acceptable? That seems quite slow to me, especially if you are only joining two tables and there are less than 50000 entries in each table :) You should be able to do your select in well under a second.
Indexing is what you seem to need. Try to play around with some indexes. You don't want to add more than you need, as the indexes create additional tables, and make update and insert queries a bit slower. But adding the right indexes will speed up things maybe by a factor of a 100. As a hint, indexes are very useful for attributes or combinations of attributes that appear in where clauses (or on clauses, etc.).
Try adding an index on assigncontents.AssignID and see what happens. I assume that assignments.AssignID is already an index (as primary key for the assignments table?). If not, it should maybe be.
|