Skip to content

Commit

Permalink
New year 2025 update (#69)
Browse files Browse the repository at this point in the history
* Update copyright

* Update linter
  • Loading branch information
mfvanek authored Jan 5, 2025
1 parent 19e50d7 commit 49ee4b9
Show file tree
Hide file tree
Showing 30 changed files with 39 additions and 37 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
fetch-depth: 0

- name: Lint Code Base
uses: super-linter/super-linter/slim@v7.1.0
uses: super-linter/super-linter/slim@v7.2.1
env:
VALIDATE_ALL_CODEBASE: false
VALIDATE_SQLFLUFF: true
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.idea
/.sqlfluff
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ docker run \
-e USE_FIND_ALGORITHM=true \
-e VALIDATE_SQLFLUFF=true \
-v $(pwd):/tmp/lint \
ghcr.io/super-linter/super-linter:slim-v7.1.0
ghcr.io/super-linter/super-linter:slim-v7.2.1
```

#### Windows
Expand All @@ -75,13 +75,13 @@ docker run ^
-e USE_FIND_ALGORITHM=true ^
-e VALIDATE_SQLFLUFF=true ^
-v "%cd%":/tmp/lint ^
ghcr.io/super-linter/super-linter:slim-v7.1.0
ghcr.io/super-linter/super-linter:slim-v7.2.1
```

```shell
docker run --rm ^
-v "%cd%\.github\linters\.sqlfluff":/sql/.sqlfluff:ro ^
-v "%cd%":/sql ^
-e SQLFLUFF_CONFIG=/sql/.sqlfluff ^
sqlfluff/sqlfluff:3.1.1 lint /sql
sqlfluff/sqlfluff:3.2.5 lint /sql
```
4 changes: 2 additions & 2 deletions sql/bloated_indexes.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2024. Ivan Vakhrushev and others.
* Copyright (c) 2019-2025. Ivan Vakhrushev and others.
* https://github.com/mfvanek/pg-index-health-sql
*
* Licensed under the Apache License 2.0
Expand Down Expand Up @@ -35,7 +35,7 @@ with
inner join pg_catalog.pg_class pc on pc.oid = pi.indexrelid
inner join pg_catalog.pg_namespace nsp on nsp.oid = pc.relnamespace
where
pc.relam = (select oid from pg_catalog.pg_am where amname = 'btree') and
pc.relam = (select am.oid from pg_catalog.pg_am am where am.amname = 'btree') and
pc.relpages > 0 and
nsp.nspname = :schema_name_param::text
),
Expand Down
2 changes: 1 addition & 1 deletion sql/bloated_tables.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2024. Ivan Vakhrushev and others.
* Copyright (c) 2019-2025. Ivan Vakhrushev and others.
* https://github.com/mfvanek/pg-index-health-sql
*
* Licensed under the Apache License 2.0
Expand Down
4 changes: 2 additions & 2 deletions sql/btree_indexes_on_array_columns.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2024. Ivan Vakhrushev and others.
* Copyright (c) 2019-2025. Ivan Vakhrushev and others.
* https://github.com/mfvanek/pg-index-health-sql
*
* Licensed under the Apache License 2.0
Expand All @@ -19,7 +19,7 @@ select
from pg_catalog.pg_index i
inner join pg_catalog.pg_class ic on ic.oid = i.indexrelid
inner join pg_catalog.pg_namespace nsp on nsp.oid = ic.relnamespace
inner join pg_catalog.pg_am a on a.oid = ic.relam and a.amname = 'btree'
inner join pg_catalog.pg_am am on am.oid = ic.relam and am.amname = 'btree'
inner join pg_catalog.pg_attribute col on col.attrelid = i.indrelid and col.attnum = any((string_to_array(i.indkey::text, ' ')::int2[])[:i.indnkeyatts])
inner join pg_catalog.pg_type typ on typ.oid = col.atttypid
where
Expand Down
2 changes: 1 addition & 1 deletion sql/columns_with_json_type.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2024. Ivan Vakhrushev and others.
* Copyright (c) 2019-2025. Ivan Vakhrushev and others.
* https://github.com/mfvanek/pg-index-health-sql
*
* Licensed under the Apache License 2.0
Expand Down
2 changes: 1 addition & 1 deletion sql/columns_with_serial_types.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2024. Ivan Vakhrushev and others.
* Copyright (c) 2019-2025. Ivan Vakhrushev and others.
* https://github.com/mfvanek/pg-index-health-sql
*
* Licensed under the Apache License 2.0
Expand Down
2 changes: 1 addition & 1 deletion sql/columns_without_description.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2024. Ivan Vakhrushev and others.
* Copyright (c) 2019-2025. Ivan Vakhrushev and others.
* https://github.com/mfvanek/pg-index-health-sql
*
* Licensed under the Apache License 2.0
Expand Down
2 changes: 1 addition & 1 deletion sql/duplicated_foreign_keys.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2024. Ivan Vakhrushev and others.
* Copyright (c) 2019-2025. Ivan Vakhrushev and others.
* https://github.com/mfvanek/pg-index-health-sql
*
* Licensed under the Apache License 2.0
Expand Down
2 changes: 1 addition & 1 deletion sql/duplicated_indexes.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2024. Ivan Vakhrushev and others.
* Copyright (c) 2019-2025. Ivan Vakhrushev and others.
* https://github.com/mfvanek/pg-index-health-sql
*
* Licensed under the Apache License 2.0
Expand Down
2 changes: 1 addition & 1 deletion sql/ext/slowest_queries_by_total_execution_time.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2024. Ivan Vakhrushev and others.
* Copyright (c) 2019-2025. Ivan Vakhrushev and others.
* https://github.com/mfvanek/pg-index-health-sql
*
* Licensed under the Apache License 2.0
Expand Down
2 changes: 1 addition & 1 deletion sql/ext/slowest_queries_by_total_execution_time_13.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2024. Ivan Vakhrushev and others.
* Copyright (c) 2019-2025. Ivan Vakhrushev and others.
* https://github.com/mfvanek/pg-index-health-sql
*
* Licensed under the Apache License 2.0
Expand Down
2 changes: 1 addition & 1 deletion sql/foreign_keys_with_unmatched_column_type.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2024. Ivan Vakhrushev and others.
* Copyright (c) 2019-2025. Ivan Vakhrushev and others.
* https://github.com/mfvanek/pg-index-health-sql
*
* Licensed under the Apache License 2.0
Expand Down
2 changes: 1 addition & 1 deletion sql/foreign_keys_without_index.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2024. Ivan Vakhrushev and others.
* Copyright (c) 2019-2025. Ivan Vakhrushev and others.
* https://github.com/mfvanek/pg-index-health-sql
*
* Licensed under the Apache License 2.0
Expand Down
2 changes: 1 addition & 1 deletion sql/functions_without_description.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2024. Ivan Vakhrushev and others.
* Copyright (c) 2019-2025. Ivan Vakhrushev and others.
* https://github.com/mfvanek/pg-index-health-sql
*
* Licensed under the Apache License 2.0
Expand Down
2 changes: 1 addition & 1 deletion sql/indexes_with_boolean.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2024. Ivan Vakhrushev and others.
* Copyright (c) 2019-2025. Ivan Vakhrushev and others.
* https://github.com/mfvanek/pg-index-health-sql
*
* Licensed under the Apache License 2.0
Expand Down
2 changes: 1 addition & 1 deletion sql/indexes_with_null_values.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2024. Ivan Vakhrushev and others.
* Copyright (c) 2019-2025. Ivan Vakhrushev and others.
* https://github.com/mfvanek/pg-index-health-sql
*
* Licensed under the Apache License 2.0
Expand Down
2 changes: 1 addition & 1 deletion sql/intersected_foreign_keys.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2024. Ivan Vakhrushev and others.
* Copyright (c) 2019-2025. Ivan Vakhrushev and others.
* https://github.com/mfvanek/pg-index-health-sql
*
* Licensed under the Apache License 2.0
Expand Down
4 changes: 2 additions & 2 deletions sql/intersected_indexes.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2024. Ivan Vakhrushev and others.
* Copyright (c) 2019-2025. Ivan Vakhrushev and others.
* https://github.com/mfvanek/pg-index-health-sql
*
* Licensed under the Apache License 2.0
Expand All @@ -8,7 +8,7 @@
-- Finds indexes with overlapping sets of columns.
-- For example, (A) and (A+B) and (A+B+C).
-- Some of these indexes can usually be safely deleted.
-- noqa: disable=ST09,ST05
-- noqa: disable=ST09,ST05,RF02
with
index_info as (
select
Expand Down
2 changes: 1 addition & 1 deletion sql/invalid_indexes.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2024. Ivan Vakhrushev and others.
* Copyright (c) 2019-2025. Ivan Vakhrushev and others.
* https://github.com/mfvanek/pg-index-health-sql
*
* Licensed under the Apache License 2.0
Expand Down
2 changes: 1 addition & 1 deletion sql/not_valid_constraints.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2024. Ivan Vakhrushev and others.
* Copyright (c) 2019-2025. Ivan Vakhrushev and others.
* https://github.com/mfvanek/pg-index-health-sql
*
* Licensed under the Apache License 2.0
Expand Down
2 changes: 1 addition & 1 deletion sql/possible_object_name_overflow.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2024. Ivan Vakhrushev and others.
* Copyright (c) 2019-2025. Ivan Vakhrushev and others.
* https://github.com/mfvanek/pg-index-health-sql
*
* Licensed under the Apache License 2.0
Expand Down
2 changes: 1 addition & 1 deletion sql/primary_keys_with_serial_types.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2024. Ivan Vakhrushev and others.
* Copyright (c) 2019-2025. Ivan Vakhrushev and others.
* https://github.com/mfvanek/pg-index-health-sql
*
* Licensed under the Apache License 2.0
Expand Down
2 changes: 1 addition & 1 deletion sql/sequence_overflow.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2024. Ivan Vakhrushev and others.
* Copyright (c) 2019-2025. Ivan Vakhrushev and others.
* https://github.com/mfvanek/pg-index-health-sql
*
* Licensed under the Apache License 2.0
Expand Down
8 changes: 4 additions & 4 deletions sql/tables_not_linked_to_others.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2024. Ivan Vakhrushev and others.
* Copyright (c) 2019-2025. Ivan Vakhrushev and others.
* https://github.com/mfvanek/pg-index-health-sql
*
* Licensed under the Apache License 2.0
Expand All @@ -22,7 +22,7 @@ with
),

fkeys as (
select c.conrelid
select c.conrelid as fk_oid
from
pg_catalog.pg_constraint c
inner join nsp on nsp.oid = c.connamespace
Expand All @@ -31,7 +31,7 @@ with

union

select c.confrelid
select c.confrelid as fk_oid
from
pg_catalog.pg_constraint c
inner join nsp on nsp.oid = c.connamespace
Expand All @@ -48,5 +48,5 @@ from
where
pc.relkind in ('r', 'p') and
not pc.relispartition and
pc.oid not in (select * from fkeys)
pc.oid not in (select f.fk_oid from fkeys f)
order by table_name;
2 changes: 1 addition & 1 deletion sql/tables_with_missing_indexes.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2024. Ivan Vakhrushev and others.
* Copyright (c) 2019-2025. Ivan Vakhrushev and others.
* https://github.com/mfvanek/pg-index-health-sql
*
* Licensed under the Apache License 2.0
Expand Down
2 changes: 1 addition & 1 deletion sql/tables_without_description.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2024. Ivan Vakhrushev and others.
* Copyright (c) 2019-2025. Ivan Vakhrushev and others.
* https://github.com/mfvanek/pg-index-health-sql
*
* Licensed under the Apache License 2.0
Expand Down
2 changes: 1 addition & 1 deletion sql/tables_without_primary_key.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2024. Ivan Vakhrushev and others.
* Copyright (c) 2019-2025. Ivan Vakhrushev and others.
* https://github.com/mfvanek/pg-index-health-sql
*
* Licensed under the Apache License 2.0
Expand Down
3 changes: 2 additions & 1 deletion sql/unused_indexes.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2024. Ivan Vakhrushev and others.
* Copyright (c) 2019-2025. Ivan Vakhrushev and others.
* https://github.com/mfvanek/pg-index-health-sql
*
* Licensed under the Apache License 2.0
Expand All @@ -8,6 +8,7 @@
-- Finds potentially unused indexes.
-- This sql query have to be executed on all hosts in the cluster.
-- The final result can be obtained as an intersection of results from all hosts.
-- noqa: disable=RF02
with
foreign_key_indexes as (
select i.indexrelid
Expand Down

0 comments on commit 49ee4b9

Please sign in to comment.