Skip to content Skip to sidebar Skip to footer

Mysql Left() Or Substring()?

Both of these queries will produce same result. But which one is better, faster. SELECT LEFT(textField, 100) AS first100Chars SELECT SUBSTRING(textField, 1, 100 ) Thanks.

Solution 1:

By itself there is little difference, however left can potentially utilize an index while substring cannot.

Solution 2:

Substring will take little more time than left function. Though your case is straight forward use left function only.

Post a Comment for "Mysql Left() Or Substring()?"