How do you control the order in which columns are added to a
multi-column primary key when using the declarative primary_key=True syntax?
How about when one of those columns comes from a mixin?
Context is in the mail below, any help gratefully received!
-------- Forwarded Message --------
Subject: Re: [GENERAL] performance problems with bulk inserts/updates
on tsrange with gist-based exclude constrains
Date: Mon, 19 Sep 2016 09:41:33 -0700
From: Jeff Janes <jeff.ja...@gmail.com>
To: Chris Withers <ch...@simplistix.co.uk>
CC: pgsql-general <pgsql-gene...@postgresql.org>
On Fri, Sep 16, 2016 at 2:01 AM, Chris Withers <ch...@simplistix.co.uk
I have quite a few tables that follow a pattern like this:
Column | Type | Modifiers
period | tsrange | not null
key | character varying | not null
value | integer |
"my_model_pkey" PRIMARY KEY, btree (period, key)
"my_model_period_key_excl" EXCLUDE USING gist (period WITH &&,
key WITH =)
"my_model_period_check" CHECK (period <> 'empty'::tsrange)
Try swapping the order of the columns in the exclude constraint. You
want the more selective criterion to appear first in the
index/constraint. Presumably "key with =" is the most selective,
especially if many of your periods are unbounded.
You received this message because you are subscribed to the Google Groups
To unsubscribe from this group and stop receiving emails from it, send an email
To post to this group, send email to email@example.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.