<bdo id='Zhvbr'></bdo><ul id='Zhvbr'></ul>
        <legend id='Zhvbr'><style id='Zhvbr'><dir id='Zhvbr'><q id='Zhvbr'></q></dir></style></legend>
      1. <small id='Zhvbr'></small><noframes id='Zhvbr'>

        <tfoot id='Zhvbr'></tfoot>

        <i id='Zhvbr'><tr id='Zhvbr'><dt id='Zhvbr'><q id='Zhvbr'><span id='Zhvbr'><b id='Zhvbr'><form id='Zhvbr'><ins id='Zhvbr'></ins><ul id='Zhvbr'></ul><sub id='Zhvbr'></sub></form><legend id='Zhvbr'></legend><bdo id='Zhvbr'><pre id='Zhvbr'><center id='Zhvbr'></center></pre></bdo></b><th id='Zhvbr'></th></span></q></dt></tr></i><div id='Zhvbr'><tfoot id='Zhvbr'></tfoot><dl id='Zhvbr'><fieldset id='Zhvbr'></fieldset></dl></div>

      2. 休眠 @DynamicUpdate(value=true) @SelectBeforeUpdate(value=true

        Hibernate @DynamicUpdate(value=true) @SelectBeforeUpdate(value=true) performance(休眠 @DynamicUpdate(value=true) @SelectBeforeUpdate(value=true) 性能)

                <tbody id='0E8pX'></tbody>

            1. <small id='0E8pX'></small><noframes id='0E8pX'>

              <tfoot id='0E8pX'></tfoot>

              <legend id='0E8pX'><style id='0E8pX'><dir id='0E8pX'><q id='0E8pX'></q></dir></style></legend>
                  <bdo id='0E8pX'></bdo><ul id='0E8pX'></ul>
                  <i id='0E8pX'><tr id='0E8pX'><dt id='0E8pX'><q id='0E8pX'><span id='0E8pX'><b id='0E8pX'><form id='0E8pX'><ins id='0E8pX'></ins><ul id='0E8pX'></ul><sub id='0E8pX'></sub></form><legend id='0E8pX'></legend><bdo id='0E8pX'><pre id='0E8pX'><center id='0E8pX'></center></pre></bdo></b><th id='0E8pX'></th></span></q></dt></tr></i><div id='0E8pX'><tfoot id='0E8pX'></tfoot><dl id='0E8pX'><fieldset id='0E8pX'></fieldset></dl></div>
                • 本文介绍了休眠 @DynamicUpdate(value=true) @SelectBeforeUpdate(value=true) 性能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我开始在我的 APP 中使用这 2 个休眠注释.

                  i am start using this 2 hibernate annotations in my APP.

                  @DynamicUpdate(value=true)
                  @SelectBeforeUpdate(value=true) 
                  

                  首先,我将尝试解释我对此的理解,以了解我是否正确.

                  first i will try to explain what i understand about it to know if i am right about it.

                  @DynamicUpdate(value=true)
                  

                  仅更新实体中的修改值 Hibernate 需要跟踪这些更改

                  @SelectBeforeUpdate(value=true)
                  

                  update 之前创建一个 select 以了解哪些属性已更改,这在实体已在不同会话上加载和更新时很有用 Hibernate 已退出跟踪实体变化

                  creates a select before update to know which properties has been changed this is useful when the entity has been loaded and updated on different sessions Hibernate is out of tracking entity changes

                  这两个肯定正确吗?

                  我主要关心的是.

                  DB 性能 中哪个更好或更快 一次更新实体中的所有字段生成一个选择以了解哪些列更新并仅更新修改列?

                  in DB performance which is better or faster updates all the fields in the entity at once or generate a select to know which columns update and update only the modified columns?

                  推荐答案

                  具体情况视你的情况而定.如果您的表非常简单(没有外键约束,只有很少的列,很少的索引),那么更新完整记录会更快.

                  The situation depends on your circumstance. If your table is very simple (has no foreign key constraints, only few columns, few indexes), then updating the full record is going to be faster.

                  但是,如果您的表有许多外键约束和索引,则首先选择然后更新差异会更快.这是因为 PostgreSQL 必须为更新中的每一列做以下工作:

                  If, however, your table has many foreign key constraints and indexes, it will be faster to first select and then update the differences. This is because PostgreSQL has to do the following work for each column in the update:

                  • 检查外键约束
                  • 更新相关索引

                  此外,这些更改增加了必须通过真空清理的表的膨胀.

                  Furthermore, the changes add bloat to the tables which must be cleaned up by vacuum.

                  请记住,如果您在具有许多表的数据库上使用 dynamicUpdate,并且您的更新看起来非常不同,您将开始逐出缓存的查询计划.这些计划花费资源来计算新的.不过,缓存的计划可能只对同一会话中的后续查询有用.

                  Keep in mind that if you use dynamicUpdate on a database with many tables, and your updates look very different, you'll start evicting cached query plans. Those plans cost resources to compute fresh. Though, cached plans might only be useful to subsequent queries in the same session anyhow.

                  这篇关于休眠 @DynamicUpdate(value=true) @SelectBeforeUpdate(value=true) 性能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Slf4j LoggerFactory.getLogger and sonarqube(Slf4j LoggerFactory.getLogger 和 sonarqube)
                  Security - Array is stored directly(安全性 - 数组直接存储)
                  SonarQube quot;Class Not Foundquot; during Main AST Scan(SonarQube“找不到类在主 AST 扫描期间)
                  Integrate Spock#39;s test with Sonar(将 Spock 的测试与声纳集成)
                  How do I make Hudson/Jenkins fail if Sonar thresholds are breached?(如果违反声纳阈值,我如何让 Hudson/Jenkins 失败?)
                  automatically add curly brackets to all if/else/for/while etc. in a java code-base(自动将大括号添加到 java 代码库中的所有 if/else/for/while 等)

                  <tfoot id='7yLgX'></tfoot>
                    <i id='7yLgX'><tr id='7yLgX'><dt id='7yLgX'><q id='7yLgX'><span id='7yLgX'><b id='7yLgX'><form id='7yLgX'><ins id='7yLgX'></ins><ul id='7yLgX'></ul><sub id='7yLgX'></sub></form><legend id='7yLgX'></legend><bdo id='7yLgX'><pre id='7yLgX'><center id='7yLgX'></center></pre></bdo></b><th id='7yLgX'></th></span></q></dt></tr></i><div id='7yLgX'><tfoot id='7yLgX'></tfoot><dl id='7yLgX'><fieldset id='7yLgX'></fieldset></dl></div>
                        <tbody id='7yLgX'></tbody>
                          <bdo id='7yLgX'></bdo><ul id='7yLgX'></ul>
                        • <small id='7yLgX'></small><noframes id='7yLgX'>

                          1. <legend id='7yLgX'><style id='7yLgX'><dir id='7yLgX'><q id='7yLgX'></q></dir></style></legend>