2

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.

2
  • Could you provide more detail about what you're doing? I'm interested to know why you're planning on repeatedly truncating text Commented 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! Commented Sep 8, 2010 at 0:33

1 Answer 1

2

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.]

Sign up to request clarification or add additional context in comments.

5 Comments

@Mitch - I took the liberty of removing a couple of superfluous T's left behind!
yeah sorry I was pretty implicit with it being in my tag only
@Martin Smith: TSQL is a standard, isn't it? but if it's not thanks! :)
do you have a reference or an explanation for why SQL performs poorly at intensive string handling?
@stevebot: it's from experience. But you can quickly write some small tests to verify...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.