Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.
Seems the MySQL performance forums don't get huge amounts of traffic. Can anyone recommend a good forum where I can start asking MySQL tuning questions and actually have a chance of getting them answered?
If you're curious, my current dilemma involves a 50 second response time on a simple join. I've run both OPTIMIZE and ANALYZE over the tables in the query and after about an hour and a quarter, the index I list in that post was finally created. However, it had no affect on query performance and the only difference in the EXPLAIN is that it listed the index as another possible key but didn't use it.
In short, I'm stuck. I don't know what to do next and I have no idea how that index can be applied to our production database without bringing the box to its knees (I have no admin skills). One person said "just don't use joins" and I might have to for this simple query, but not being able to use joins in SQL means I might as well fall back to a flat file database -- something I honestly feel I could optimize easier than our current MySQL setup
join? (Score:1)
How fast is
SELECT authname FROM invoices i WHERE i.affid = 654248 AND i.commpaid = 0;You're doing a full table scan on invoices alone, without the join, and that SHOULD be painful.
So, index on affid.
Re: (Score:2)
Bingo! That reduces the query time down to .15 seconds :)
I don't understand the EXPLAIN output as well as I should (duh!). How did you deduce the full table scan on invoice from this?
Re: (Score:1)
Re: (Score:2)
Ilya Martynov (http://martynov.org/ [martynov.org])
Re: (Score:2)
Ilya Martynov (http://martynov.org/ [martynov.org])
Re: (Score:1)
With the original setup, there was a key (and therefore likely an index) on b.desctype, limiting the need for a full tablescan on bills down to "just" half the table. Which turns out to be slightly less work than a full table scan on invoices. So now it has a (long) list of invoice id's it can use the primary key index on invoices to find.
Adding the index on affid, makes it a LOT cheaper to use that than either the full or
Re: (Score:1)
By about an order of magnitude.
The actual figure is highly hardware dependent, but should generally be in the range 5-10%.
Cheers,
Ben
wrong indexes (Score:2)
On second thought you probably should have mu
Ilya Martynov (http://martynov.org/ [martynov.org])
Re: (Score:2)
Why the multi-column index? (if you see my response above, the index on affid was enough to solve this). The multi-column index on affid and commpaid generates the following:
Re: (Score:2)
Ilya Martynov (http://martynov.org/ [martynov.org])
Re: (Score:2)
It is a boolean value, so just zero or one. And yes, I was researching 'rows' in the past as a means of easily identifying after the fact whether or not a table had records added or deleted and I recall that this value is indeed not always completely accurate. Sometimes merely altering data seemed to change that value.
Re: (Score:1)
try this one (Score:1)
Re: (Score:1)
try this one (Score:1)
FROM bill b INNER JOIN invoices i USING(invoice)
WHERE i.affid = 654248 AND b.desctype = 0 AND i.commpaid = 0;
Now, i think you probably want to have invoice indexed on both sides of the equation, BUT since mysql can only use one index per table I suggest you have an index on i (invoice, affid) and b (invoice)
I don't know how your tables look with data in them or your other queries, but you should probably have less indexes and more indexes tha