← Back to team overview

maria-discuss team mailing list archive

Re: optimization

 

Hi, Roberto!

On Aug 12, Roberto Spadim wrote:
> guys, i have some queries like this:
> SELECT doc_hash_key FROM mov_documentos WHERE doc_hash_key LIKE
> "j;1;$;294007/3nfe-1%"
> UNION
> SELECT doc_hash_key FROM mov_documentos WHERE doc_hash_key LIKE
> "j;1;%;294007/3nfe-1%"
> UNION
> SELECT doc_hash_key FROM mov_documentos WHERE doc_hash_key LIKE
> "j;1;%;%294007/3nfe-1%"
> UNION
> SELECT doc_hash_key FROM mov_documentos WHERE doc_hash_key LIKE
> "%;%;$;%294007/3nfe-1%"
> UNION
> SELECT doc_hash_key FROM mov_documentos WHERE doc_hash_key LIKE
> "%;%;%;294007/3nfe-1%"
> UNION
> SELECT doc_hash_key FROM mov_documentos WHERE doc_hash_key LIKE
> "%;%;%;%294007/3nfe-1%"
> LIMIT 1
> 
> 
> it's a search about a document number, but the problem is....
> the first query at first line (with % at end of the query) return really
> fast, but executing others queries are very slow, the question is
> could we optimize this kind of query, since limit=1 row?

Sounds very reasonable. And, I hope, not too difficult to implement.
Could you please put this in Jira?

Regards,
Sergei


Follow ups

References