FogBugz Attachment Storage: On-Demand vs On-Premise Database



While FogBugz On-Demand and On-Premise do not have significant differences in code, there is a difference in the way we store the attachment information: for On-Premise, all the attachments are stored in the database as BLOBs, while for On-Demand we store the attachments in an AWS S3 bucket.




The reason for moving the attachments outside the database is simple: improve performance for On-Demand instances. However, for On-Premise setups, having an S3 bucket would add extra complexity to the system, which is not necessary since it would not necessarily improve the performance (but definitely increase the maintenance cost).

Note: This architectural difference between On-Demand and On-Premise is the reason why data exports of the On-Demand databases do not contain the actual attachments. We have no plans of changing this.


Database Schema for Attachments (Table Structure)

The information below applies to files attached to cases.


  • ixAttachment (int(11)) - This is the AutoNumber primary key.

  • sData (image) - The binary data of the attachment.

  • sFilename (nvarchar(255)) - The filename of the attachment.

  • fFileStatus (int) - Shows whether or not the file has been deleted:

    • 1 = deleted.

    • 0 = not deleted.

  • fMogileStatus (int):

    Used exclusively in the FogBugz On Demand platform.

    • 0 = Only in the DB.

    • 1 = In Mogile and the DB.

    • 2 = Only in Mogile.

    • 3 = Only in the S3 Bucket.

  • cBytes (int) - This refers to the file size in bytes.

    The value is -1 if the size has not yet been calculated.

  • sMogileKey (nvarchar(255)) - This shows the Mogile (legacy) or Amazon S3 key for this attachment if it exists and is not calculated.


On-Demand Storage

Our On-Demand platform stores the information for each attachment into S3 Buckets. These buckets' keys are referenced in the database under [dbo].[Attachment] > sMogileKey column.



On-Premise Storage

Our On-Premise platform stores the information for each attachment into the database as BLOBs. Each BLOB is referenced in the database under [dbo].[Attachment] > sData column.



Back to top