Reg performance issues while passing the tableName as mybatis parameter

11 views
Skip to first unread message

Anjali Selvaraj

unread,
Nov 12, 2020, 3:18:51 PM11/12/20
to mybatis-user
Hello All, 
Hope you are being safe and well. 
I am using mybatis xml mapper for SQL Server. I am having a statement like 

<delete>
DELETE FROM ${tableName} where val = #{val}
</delete>

I want to know if it will cause any performance issues

Guy Rouillier

unread,
Nov 12, 2020, 8:15:41 PM11/12/20
to MyBatis User
Because the table name is being passed in dynamically, the DBMS will not be able to plan ahead.  So you'll encounter that penalty for dynamic SQL.  But if your "val" column is indexed, performance should be okay; if not, performance will suffer. 

--
Guy Rouillier
--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mybatis-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mybatis-user/e18f4a77-4975-4b2c-b6dc-06378ddffa66n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages