Does anybody know what the performance of using substring in MySQL is like? I have some insert and update calls where I have to truncate all the fields (up to around 15) using substring statements. These will get call pretty regularly so I'm a little worried about performance.
-
Could you provide more detail about what you're doing? I'm interested to know why you're planning on repeatedly truncating textOMG Ponies– OMG Ponies2010-09-08 00:29:31 +00:00Commented Sep 8, 2010 at 0:29
-
If you have to trim text, becuase it's part of some ETL process say, then you have to trim text, whether or not it performs badly!Mitch Wheat– Mitch Wheat2010-09-08 00:33:16 +00:00Commented Sep 8, 2010 at 0:33
Add a comment
|
1 Answer
Intensive string handling in SQL generally performs relatively poorly (it's not what SQL was designed for).
But you should first profile to make sure you actually have a bottleneck.
[If you were using MS SQL Server, then any complex string handling (like regular expression matching) should probably use a CLR stored procedure.]
5 Comments
Martin Smith
@Mitch - I took the liberty of removing a couple of superfluous
T's left behind!stevebot
yeah sorry I was pretty implicit with it being in my tag only
Mitch Wheat
@Martin Smith: TSQL is a standard, isn't it? but if it's not thanks! :)
stevebot
do you have a reference or an explanation for why SQL performs poorly at intensive string handling?
Mitch Wheat
@stevebot: it's from experience. But you can quickly write some small tests to verify...