· 8 years ago · Aug 16, 2018, 01:38 AM
1Low priority updates on MySQL using JDBC - how to check if they work
2<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
3 <!-- other props omitted -->
4 <property name="connectionInitSqls">
5 <list>
6 <value>SET low_priority_updates="ON"</value>
7 </list>
8 </property>
9 </bean>
10
11CREATE TABLE `mydb`.`my_low_priority_updates` (
12 `connection_id` INT ,
13 `low_priority_updates_value` INT NOT NULL
14)
15ENGINE = MyISAM;
16
17insert into my_low_priority_updates(connection_id,low_priority_updates_value)
18select connection_id(),@@session.low_priority_updates
19from dual
20where not exists (select 1 from my_low_priority_updates where connection_id=connection_id())