← Back to team overview

maria-developers team mailing list archive

Performance: question about strings created in sql_lex.cc



When parsing an SQL query, the function get_text() in sql_lex.cc
always makes a copy of the string, allocating new memory
using lip->m_thd->alloc() and copying the original string
from the SQL query fragment to this new memory.

Note, this happens even if the string does not have any
escaped characters!

I'm seeing some performance bottleneck here.
It would be nice to avoid copying.

Why could not we point a non-escaped string to the original SQL
query fragment where the string is actually written?

Are there any situations when the original SQL query is not accessible
any more, but Item_string created at parse time is still in use?

Are there any other things that are created in sql_yacc.yy
using the TEXT_STRING token, which could exist longer than
the original SQL query?