The list of all the queries

Very similar domain names

Query goal: Find pairs of names of domains that are very similar or even equal.
Notes about the query: The query finds the pairs of domain names where the Levenshtein distance between the names is less than three. The query uses a function from the fuzzystrmatch extension.
Query type: Problem detection (Each row in the result could represent a flaw in the design)
Query reliability: Medium (Medium number of false-positive results)
Query license: MIT License
Fixing suggestion: Make sure that the names are correct and there are no duplication or unused domains.
Data source: INFORMATION_SCHEMA only
SQL query: Click on query to copy it

CREATE EXTENSION IF NOT EXISTS fuzzystrmatch;
WITH domains AS (SELECT domain_schema, domain_name
FROM information_schema.domains
WHERE domain_schema NOT IN (SELECT schema_name
FROM INFORMATION_SCHEMA.schemata
WHERE schema_name<>'public' AND
schema_owner='postgres' AND schema_name IS NOT NULL))
SELECT d1.domain_schema AS domain1_schema, d1.domain_name AS domain1_name,
d2.domain_schema AS domain2_schema, d2.domain_name AS domain2_name
FROM domains AS d1, domains AS d2
WHERE NOT (d1.domain_schema=d2.domain_schema AND d1.domain_name=d2.domain_name)
AND levenshtein(d1.domain_name,d2.domain_name)<=2
ORDER BY domain1_name, domain2_name;

DROP EXTENSION IF EXISTS fuzzystrmatch;

Collections where the query belongs to

Collection nameCollection description
Find problems automaticallyQueries, that results point to problems in the database. Each query in the collection produces an initial assessment. However, a human reviewer has the final say as to whether there is a problem or not .

Categories where the query belongs to

Category nameCategory description
DomainsQueries of this category provide information about reusable specifications of column properties.
Duplication of implementation elementsQueries of this catergory provide information about the duplication of the database objects.
NamingQueries of this category provide information about the style of naming.
Unused implementation elementsQueries of this catergory provide information about the database objects that are not used.

The list of all the queries