天天看点

PgSQL多个参数查询以及是否锁表

Mybatis 多个参数批量查询写法

<select id="queryUUidByPortName"
        parameterType="com.chinamoblie.cmss.idcbussiness.entity.QueryResource"
        resultType="map"
>
    SELECT
    t1.uuid AS "originalResourceId",
    t1.zh_label AS "portName",
    t2.uuid AS "equipmentUUID",
    t2.zh_label AS "equipmentName"
    FROM
    cm_device_ip_idc t2,
    cm_port_ip_ptp_idc t1
    where  (t2.zh_label,t1.zh_label) in
    <foreach collection="list" item="item" open="(" close=")" separator=",">
        (#{item.equipmentName},#{item.portName})
    </foreach>
           

执行如果卡住,看看是不是有锁表

select oid,relname from pg_class where relname='cm_device_core_nfv';

select locktype,database,pid,relation ,mode from pg_locks where relation='206761';

select * from pg_stat_activity where pid = '30046';

select pg_terminate_backend('30046');