From: Daniel Verite <daniel@manitou-mail.org>
To: Richard van der Hoff <richard@matrix.org>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Inexplicable duplicate rows with unique constraint
Date: Thu, 16 Jan 2020 18:24:48 +0100
Message-ID: <f2f4c44f-5673-496b-b42b-cf63ba483a5e@manitou-mail.org> (raw)
In-Reply-To: <288488b7-d3b6-905b-3706-43f7a3c7bc52@matrix.org>
Richard van der Hoff wrote:
> synapse=> select count(*), room_id, type, state_key from
> current_state_events group by 2,3,4 order by count(*) DESC LIMIT 2;
> count | room_id | type | state_key
> -------+-----------------------------------+---------------+-------------------------------------
> 3 | !ueLfVrSWYGMnFnoCbT:darkfasel.net | m.room.member |
> @irc_ebi_:darkfasel.net
> 3 | !HwocBmCtBcHQhILtYQ:matrix.org | m.room.member |
> @freenode_AlmarShenwan_:matrix.org
Looking at these columns which are of type text but do not
contain words of any particular language, there's probably
no point in using a linguistic-aware collation for them.
If you maintain the database schema, what you could do to avoid
the dependency on the OS collation and stay clear of the particular
upgrade difficulty of collations is to use COLLATE "C" for this kind of
field, as opposed to the default collation of the database.
As a bonus, operations with the "C" collations tend to be faster,
sometimes even much faster.
Best regards,
--
Daniel Vérité
PostgreSQL-powered mailer: http://www.manitou-mail.org
Twitter: @DanielVerite
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: daniel@manitou-mail.org, richard@matrix.org
Subject: Re: Inexplicable duplicate rows with unique constraint
In-Reply-To: <f2f4c44f-5673-496b-b42b-cf63ba483a5e@manitou-mail.org>
References: <288488b7-d3b6-905b-3706-43f7a3c7bc52@matrix.org> <f2f4c44f-5673-496b-b42b-cf63ba483a5e@manitou-mail.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox