Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ask about batch update support #31012

Closed
corgy-w opened this issue Apr 25, 2024 · 4 comments
Closed

Ask about batch update support #31012

corgy-w opened this issue Apr 25, 2024 · 4 comments

Comments

@corgy-w
Copy link

corgy-w commented Apr 25, 2024

Does sharding support updatebatch now

ex:

 <update id="batchUpdateByPrimaryKeySelective" parameterType="java.util.List">
        <foreach collection="list" item="item" separator=";">
            UPDATE users SET
            tenant_id = #{item.tenantId},
            phone = #{item.phone},
            phone_cipher = #{item.phoneCipher},
            email = #{item.email},
            email_cipher = #{item.emailCipher},
            ssn = #{item.ssn},
            ssn_cipher = #{item.ssnCipher},
            is_deleted = 'N',
            creator = 'seatunnel',
            modifier = 'seatunnel',
            gmt_created = #{item.gmtCreated},
            gmt_modified = #{item.gmtModified}
            WHERE tenant_id = #{item.tenantId} AND id = #{item.id}
        </foreach>
    </update>
@zzyReal666
Copy link
Contributor

zzyReal666 commented Apr 26, 2024

  • I have tested SQLServe using JDBC and it supports batch processing.
  • AS for your ORM framework,you can do a simple test.

@corgy-w
Copy link
Author

corgy-w commented Apr 26, 2024

  • I have tested SQLServe using JDBC and it supports batch processing.
  • AS for your ORM framework,you can do a simple test.
UPDATE users SET
            tenant_id = ?,
            phone = ?,
            phone_cipher = ?,
            email = ?,
            email_cipher = ?,
            ssn = ?,
            ssn_cipher = ?,
            is_deleted = 'N',
            creator = 'seatunnel',
            modifier = 'seatunnel',
            gmt_created = ?,
            gmt_modified = ?
            WHERE tenant_id = ? AND id = ?; 
            UPDATE users SET
            tenant_id = ?,
            phone = ?,
            phone_cipher = ?,
            email = ?,
            email_cipher = ?,
            ssn = ?,
            ssn_cipher = ?,
            is_deleted = 'N',
            creator = 'seatunnel',
            modifier = 'seatunnel',
            gmt_created = ?,
            gmt_modified = ?
            WHERE tenant_id = ? AND id = ? 

I have tested update batch and it not support . shariding version :5.2.1.
Example statement above

Error as follows
image

@zzyReal666
Copy link
Contributor

  • I have tested SQLServe using JDBC and it supports batch processing.
  • AS for your ORM framework,you can do a simple test.
UPDATE users SET
            tenant_id = ?,
            phone = ?,
            phone_cipher = ?,
            email = ?,
            email_cipher = ?,
            ssn = ?,
            ssn_cipher = ?,
            is_deleted = 'N',
            creator = 'seatunnel',
            modifier = 'seatunnel',
            gmt_created = ?,
            gmt_modified = ?
            WHERE tenant_id = ? AND id = ?; 
            UPDATE users SET
            tenant_id = ?,
            phone = ?,
            phone_cipher = ?,
            email = ?,
            email_cipher = ?,
            ssn = ?,
            ssn_cipher = ?,
            is_deleted = 'N',
            creator = 'seatunnel',
            modifier = 'seatunnel',
            gmt_created = ?,
            gmt_modified = ?
            WHERE tenant_id = ? AND id = ? 

I have tested update batch and it not support . shariding version :5.2.1. Example statement above

Error as follows image

  • Based on the current logs, the problem is with the sql format rather than the batch support;
  • Please provide detailed logs, especially for logical and actual SQL;
  • There are my test reults,use version master:
    image
    image

@zzyReal666
Copy link
Contributor

  • Multiple SQL statements are not supported.
  • Please use JDBC batch.

@corgy-w corgy-w closed this as completed Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants