5 Replies Latest reply on Mar 21, 2011 6:02 PM by lukasz.antoniak

    Is indexing on Eners audit tables possible

    tsnyman

      Hi

      We have several indexes annotated on classes that are marked as @Audited. I am wondering if there is a way of transferring these indexing to the _aud tables or is there no sense in doing this for performance.

        • 1. Is indexing on Eners audit tables possible
          adamw

          Envers mainly uses the revision number + id of the entity (origina id). So if you are reading history it may be useful to add indexes on these fields (which constitute the primary id of the audit entities).

           

          Adam

          • 2. Is indexing on Eners audit tables possible
            tsnyman

            Thanks Adam,

             

            If I have the following annotation for example to specify indexes for an entity that is marked as @Audited

             

            @org.hibernate.annotations.Table(appliesTo = "table1", indexes = {

                    @Index(name = "column1_column2", columnNames = {"column1", "column2" })

                })

             

            an index column1_column2 is created on the main table table1. I was hoping, that a similar index would then be created on table1_aud so that if I read history with AuditReader API, I can specify criteria for these columns.

             

            Do I have to manually create such and index as above on the _aud table

            • 3. Is indexing on Eners audit tables possible
              adamw

              Yes, I think indexes currently aren't copied over - so yes, you have to add them manually. They will be useful if you are doing history queries using those fields.

               

              Please file a JIRA if you feels this an important issue. Also, any contributions are welcome! If you would like to approach creating a patch, let me know.


              Adam

              • 4. Is indexing on Eners audit tables possible
                tsnyman

                Thanks,

                 

                For now I am happy to create the indexes manually

                • 5. Is indexing on Eners audit tables possible
                  lukasz.antoniak

                  I have created JIRA issue: HHH-6035.

                   

                  Regards,

                  Lukasz Antoniak

                  1 of 1 people found this helpful