Skip to content

Update PMDB schema for EPSS

Introduction

We need to have a new table to store the EPSS scores along with the CVE id that maps to it.

Proposal

Store the EPSS scores and their percentile in the Postgresql database of the PMDB.

Percentiles aren't used at the beginning, but they're stored for future use.

table name: epss_score

column type size
id bigint 8 bytes
score real double precision 4 8 bytes
percentile real double precision 4 8 bytes
created_at timestampz 8 bytes
updated_at timestampz 8 bytes
cve_id text up to 255 bytes (usually less)

See guidelines on ordering table columns.

We would index the following columns:

column type size
id bigint 8 bytes
cve_id text up to 255 bytes (usually less). Unique index since cve_id is unique

We would add a check length constraint to the cve_id (max length is 255 bytes), and a unique constraint.

Total column size is 48 bytes (for columns) + 24 bytes (for indexes) = 72 bytes.

Let's round this up to 100 bytes. We expect to get at most 250k records every day. This would take roughly 25MB.

Implementation plan

  • Create a migration script and test it locally
  • Release
  • Deploy the new schema version on dev
  • Deploy the new schema version on prod
Edited by Orin Naaman