Reputation: 81
I currently have two custom functions in a MySQL query:
proper
converts any text to proper case format (john smith -> John Smith)
HTML_Unencode
decodes HTML entities (BB '
T -> BB&T).
When I run both together it nearly doubles the query runtime. I need a solution that can be run from within the current query. Any suggestions?
SELECT
proper(HTML_UnEncode(`order`.`shipping_city`)) AS `City`
FROM `order`
Input
Queébec
Output
Québec
Upvotes: 1
Views: 58
Reputation: 2383
How to perform the functions of both proper
and HTML_UnEncode
faster at query time? I don't know.
But - I strongly suggest not doing it at query time. You insert a row once, but query it many times. So pay the cost at insert time.
In other words - if you can - rather store Québec
(and not Québec
) into the table. Then your query is both simpler and much faster
SELECT
`order`.`shipping_city` AS `City`
FROM `order`
Upvotes: 1