1 Reply Latest reply on Feb 15, 2013 7:37 AM by Adam Warski

    Auditing Blobs - Use audited blobs as live data?

    teinacher Newbie

      Hi there,

       

      I'm using Envers to audit a table which contains blobs. I'm wonding if it is possible to use a view on the audit table as the live table, for two reasons:

       

      A) Saving table space. Having the same blob in both the live table and the audit table (at least for the most recent revision) is redundant. Making the live table (or at least the blob column) point to the audit table seems smarter. But this reasons is less important than reason B)

      B) Increasing insert/update performance. I noticed that inserting a blob takes twice as long with auditing on, because inserting into the audit table takes the same time as inserting into the live table alone. If we could insert only into the audit table, that would be a nice performance boost for our users

       

      Besides using a view on the audit table, I also had the idea of making the blob attribute transient and using a subselect on the audittable to fill the attribute. But then, because of the transient annotation, the blobs won't get audited.

       

      I'm not sure how to achieve the goal of using audited data as live data, which is why I'm asking if anyone has done something similar and how it was done.

        • 1. Re: Auditing Blobs - Use audited blobs as live data?
          Adam Warski Master

          Envers doesn't currently support this. Maybe what you could try (may be a good idea anyway) is to store the blobs in a separate table, and then store just ids where the blobs are referenced.

          That way:

          • you can load the blob lazily if required
          • envers will always load the blob lazily
          • the blob will get written in the audit table only if the blob changes (not if anything changes in the referencing table)

           

          Adam