Re: Procedure Inconsistent Performance
Best strategy is to debug and tune each query in turn outside an sproc.
Re the first query, select a,b,c,d,min(e) ... group by a returns arbitrary results for b,c,d unless there is a 1:1 relationship between a, and b c and d. You need to prove those relationships are 1:1 before leaving b,c,d out of the Group By clause.
Re both queries, as the manual's page on joins makes clear, comma join syntax (...from pqrs, abcd where...) can yield errors when combined with explicit join syntax (...from ... join ... on...). Since explicit join syntax is much easier to write debug and maintain, best practice is to avoid comma join syntax altogether.
Once each query is proved to return correct results in all relevant cases, run Explain on each one and configure table indexes to optimise performance. When the query involves Insert...Select, run Explain on the Select portion first, get that query tuned, then run Explain on the whole query. See the manual pages on optimisation and on Explain.