public inbox for [email protected]  
help / color / mirror / Atom feed
From: Holger Jakobs <[email protected]>
To: [email protected]
Subject: Re: Duplicate Extended Statistics
Date: Wed, 4 Sep 2024 10:43:12 +0200
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAJ9xe=u0FykfAi-ihsjVRkZ3XiJLbW97+BYhEnFo1_3wcps8AA@mail.gmail.com>
References: <[email protected]>
	<CAJ9xe=u0FykfAi-ihsjVRkZ3XiJLbW97+BYhEnFo1_3wcps8AA@mail.gmail.com>

Am 04.09.24 um 10:28 schrieb Asad Ali:
> Hi Ilia,
>
> In PostgreSQL, it is possible to create duplicate extended statistics 
> because the system does not enforce uniqueness on statistics 
> definitions. However, this is generally not recommended, as it leads 
> to longer ANALYZE times, increased storage usage, potential planner 
> performance impact, and unnecessary complexity. In practice, 
> duplicates are rare because users and tools usually avoid redundancy, 
> as there is no added benefit to having multiple identical sets of 
> statistics on the same columns.
>
> Regards,
> Asad Ali
>
>
To find duplicate indexes:

SELECT  indrelid::regclass::text AS "Table Name",
         string_agg(indexrelid::regclass::text ||
           CASE WHEN indisunique
           THEN ' (UNIQUE)' ELSE ''
           END, ', ') AS "Indexes"
       FROM pg_index
       GROUP BY indrelid, indkey
       HAVING COUNT(*) > 1

-- 

Holger Jakobs, Bergisch Gladbach



Attachments:

  [application/pgp-signature] OpenPGP_signature (203B, 3-OpenPGP_signature)
  download

view thread (4+ messages)

reply

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 using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: Duplicate Extended Statistics
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox