"global" & shared sequences

From: Jonathan Vanasco <postgres(at)2xlp(dot)com>
To: PostgreSQL mailing lists <pgsql-general(at)postgresql(dot)org>
Subject: "global" & shared sequences
Date: 2015-10-01 23:48:47
Message-ID: 91D20898-1326-4CC1-9496-495FA660CAB1@2xlp.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hoping to glean some advice from the more experienced....

The major component of our application currently tracks a few dozen object types, and the total number of objects is in the 100s Millions range. Postgres will potentially be tracking billions of objects.

Right now the primary key for our "core" objects is based on a per-table sequence, but each object has a secondary id based on a global/shared sequence. we expose everything via a connected object graph, and basically needed a global sequence. We are currently scaled vertically (1x writer, 2x reader)

I'd like to avoid assuming any more technical debt, and am not thrilled with the current setup. Our internal relations are all by the table's primary key, but the external (API, WEB) queries use the global id. Every table has 2 indexes, and we need to convert a 'global' id to a 'table id' before doing a query. If we're able to replace the per-table primary key with the global id, we'd be freeing up some disk space from the indexes and tables -- and not have to keep our performance cache that maps table-to-global ids.

The concerns that I have before moving ahead are:

1. general performance at different stages of DB size. with 18 sequences, our keys/indexes are simply smaller than they'd be with 1 key. i wonder how this will impact lookups and joins.
2. managing this sequence when next scaling the db (which would probably have to be sharding, unless others have a suggestion)

if anyone has insights, they would be greatly appreciated.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joseph Kregloh 2015-10-02 01:04:34 Re: Postgresql 9.4 and ZFS?
Previous Message Jim Nasby 2015-10-01 22:28:21 Re: Serialization errors despite KEY SHARE/NO KEY UPDATE