The Vertex Imaginary Weight



Imaginary Weight Calculation Rules:

  • Long: 8 bytes

  • UUID: 16 bytes

  • String (for @Column without explicit length, or unannotated): 255 bytes

  • Foreign Key (FK) references to other entities (e.g., AreaType<?>): 8 bytes (assuming a Long ID)

  • Newline character (\n): 1 byte (per instance)

  • List type fields (representing relationships like @OneToMany, @ManyToMany): 0 bytes (as they are typically stored in join tables or separate rows, not directly in the current class's row size).


Imaginary Weight Report (Lighter to Heavier)

  1. AreaType 1

    • Fields (inferred from BaseType constructors): typeId (Long), gid (UUID), name (String)

    • Calculation: 8 (Long) + 16 (UUID) + 255 (String) + 1 (newline) = 280 bytes

  2. ArtistType 2

    • Fields (inferred from BaseType constructors): typeId (Long), gid (UUID), name (String)

    • Calculation: 8 (Long) + 16 (UUID) + 255 (String) + 1 (newline) = 280 bytes

  3. Gender 3

    • Fields (inferred from BaseType constructors): typeId (Long), gid (UUID), name (String)

    • Calculation: 8 (Long) + 16 (UUID) + 255 (String) + 1 (newline) = 280 bytes

    Note: AreaType, ArtistType, and Gender have the same calculated imaginary weight based on their shared BaseType structure.

  4. Area 4

    • areaId: Long = 8 bytes

    • gid: UUID = 16 bytes

    • areaType: FK = 8 bytes

    • areaBeginDate: FK = 8 bytes

    • areaEndDate: FK = 8 bytes

    • areaComment: FK = 8 bytes

    • areaName: String (VARCHAR NOT NULL) = 255 bytes

    • Calculation: 8 + 16 + 8 + 8 + 8 + 8 + 255 + 1 (newline) = 312 bytes

  5. Artist 5

    • artistId: Long = 8 bytes

    • gid: UUID = 16 bytes

    • artistName: String (VARCHAR NOT NULL) = 255 bytes

    • artistSortName: FK = 8 bytes

    • artistComment: FK = 8 bytes

    • artistBeginDate: FK = 8 bytes

    • artistEndDate: FK = 8 bytes

    • artistType: FK = 8 bytes

    • gender: FK = 8 bytes

    • area: FK = 8 bytes

    • beginArea: FK = 8 bytes

    • endArea: FK = 8 bytes

    • artistCredits: List (excluded) = 0 bytes

    • artistAlias: List (excluded) = 0 bytes

    • Calculation: 8 + 16 + 255 + 8 + 8 + 8 + 8 + 8 + 8 + 8 + 8 + 8 + 1 (newline) = 350 bytes





Comments