How do I reduce time spent "preparing"? I have a query I need to make more efficient. Trying a couple different things, one of which is SHOW PROFILE . That shows that the most massive timesink by far is "preparing".

As far as I understand, that state indicates that the database is planning, preparing and generally thinking about how to get the results most efficiently which leads me to belive that it can be reduced by providing hints, indices or rewriting the query.

Exactly how those hints, indicies or rewrites should be made escapes me though.

How do I go about optimizing "preparing". All I have now is a single profile row and a search enginge that directs me to articles about prepared statements.

PS: I realise that the "correct" answer probably is "Rewrite everything into normalised tables, relations and make a better query", which is what I'm actually doing.
Preparing also include parsing and compilation of query into native inner code. Replace direct queries by stored routines that compiled once at creation time.