SQL Server 2025! This is gold 💰 ... When REGEXP is FASTER than LIKE! try it!
SQL Server 2025 Surprise! When REGEXP_LIKE is faster Than LIKE Hi SQL SERVER Guys, If you missed my previous post about the new REGEX functions, you can find it here: 👉 Why REGEX Functions in SQL Server 2025 Matter While if you missed my previous post, you can find it here: 👉 Why REGEX functions in SQL SERVER 2025 can melt you CPU? Try yourself! Today we go one step further… and this is something that might sound crazy at first . In some scenarios, REGEXP_LIKE can be up to 10x faster than LIKE . Yes… faster than LIKE! The Test: REGEX vs LIKE Let’s start with a simple dataset: CREATE TABLE Logs ( id INT IDENTITY, message NVARCHAR(400) ); INSERT INTO Logs(message) SELECT REPLICATE('error ',5) + CAST(ROW_NUMBER() OVER (ORDER BY (SELECT NULL)) AS NVARCHAR) FROM sys.objects a CROSS JOIN sys.objects b; This creates hundreds of thousands of rows . Query 1 – LIKE SET STATISTICS TIME ON; SELECT COUNT(*) FROM Logs WHERE m...