Re: Index over only uncommon values in table

From: David Johnston <polobo(at)yahoo(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Index over only uncommon values in table
Date: 2013-06-18 20:49:30
Message-ID: 1371588570393-5759748.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Steven Schlansker-3 wrote
> At some point, the code changes, and CURRENT_VERSION gets incremented.
> Rows then slowly (over a period of days / weeks) get "upgraded" to the new
> current version, in batches of thousands.
>
> This is what I mean by a very slowly changing mostly-constant value.

This seems insane without knowing the details. This seems like it would be
more of a cache invalidation problem. What percentage of your rows are
being updated multiple times without ever being queried for other reasons?

I was going to say that table partitioning (INHERITS) seems like a
possibility; then I thought maybe not; now I'm back to suggesting you
consider it.

Every version of the extractor would get its own table. To "upgrade" you
remove the record from the older table and add it to the newer one. Maybe
even consider calling the these "version_upgraded" to distinguish them from
records originally insert using the newest version. Or have "original
version" as the partition key and a second "current version" field that
varies. Not sure how the planner would be able to use constraint exclusion
to limiting the scanning though...

Hope this helps.

David J.

--
View this message in context: http://postgresql.1045698.n5.nabble.com/Index-over-only-uncommon-values-in-table-tp5759735p5759748.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Lonni J Friedman 2013-06-18 21:14:49 how to reference variables in pgbench custom scripts?
Previous Message David Johnston 2013-06-18 20:11:42 Re: Index over only uncommon values in table