public long getEstimatedSizeInMemoryBytes() {
    if (this.estimatedSizeInMemoryBytes > 0) {
      return this.estimatedSizeInMemoryBytes;
    }
    long calculatedSize = Schema.BASE_RECORD_SIZE_IN_MEMORY_BYTES;

    // consider the "long" fields which mainly contribute to the size of the record
    calculatedSize += getFieldSize(Field.FAILURE_REASON);
    calculatedSize += getFieldSize(Field.CONFIGURATION_OPTIONS_CHANGED);
    calculatedSize += getFieldSize(Field.EXEC_SUMMARY);
    calculatedSize += getFieldSize(Field.PLAN);
    calculatedSize += getFieldSize(Field.SQL);

    this.estimatedSizeInMemoryBytes = calculatedSize;
    return estimatedSizeInMemoryBytes;
  }
Returns an estimated size of this record in bytes. This is used by the QueryHistoryService to sum the sizes of
records to decide if it needs to persist them (to prevent holding too many history records in memory).
This is a rough estimation in 2 steps:
1. Given a base size of the presumably "short" fields (String lengths are considered to be a constant)
2. Add the size of the "long" fields
@return estimatedSizeInMemoryBytes
ql/src/java/org/apache/hadoop/hive/ql/queryhistory/schema/Record.java