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
Attachment:
OpenPGP_signature
Description: OpenPGP digital signature