Class IndexMaintenanceImpl
- java.lang.Object
-
- io.github.mfvanek.pg.index.maintenance.IndexMaintenanceImpl
-
- All Implemented Interfaces:
HostAware
,IndexMaintenance
public class IndexMaintenanceImpl extends java.lang.Object implements IndexMaintenance
Implementation ofIndexMaintenance
which collects information from current host in the cluster.
-
-
Constructor Summary
Constructors Constructor Description IndexMaintenanceImpl(PgConnection pgConnection)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<DuplicatedIndexes>
getDuplicatedIndexes(PgContext pgContext)
Returns duplicated (completely identical) indexes (candidates for deletion) on current host.java.util.List<ForeignKey>
getForeignKeysNotCoveredWithIndex(PgContext pgContext)
Returns foreign keys without associated indexes (potential performance degradation) on current host.PgHost
getHost()
Gets information about host in the cluster.java.util.List<IndexWithBloat>
getIndexesWithBloat(PgContext pgContext)
Returns indexes that are bloated in the specified schema.java.util.List<IndexWithNulls>
getIndexesWithNullValues(PgContext pgContext)
Returns indexes that contain null values on current host.java.util.List<DuplicatedIndexes>
getIntersectedIndexes(PgContext pgContext)
Returns intersected indexes (partially identical, candidates for deletion) on current host.java.util.List<Index>
getInvalidIndexes(PgContext pgContext)
Returns invalid (broken) indexes to be deleted or re-indexed on current host with the specified schema.java.util.List<UnusedIndex>
getPotentiallyUnusedIndexes(PgContext pgContext)
Returns potentially unused indexes (candidates for deletion) on current host.java.util.List<TableWithBloat>
getTablesWithBloat(PgContext pgContext)
Returns tables that are bloated in the specified schema.java.util.List<TableWithMissingIndex>
getTablesWithMissingIndexes(PgContext pgContext)
Returns tables with potentially missing indexes (potential performance degradation) on current host.java.util.List<Table>
getTablesWithoutPrimaryKey(PgContext pgContext)
Returns tables without primary key on current host.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.github.mfvanek.pg.index.maintenance.IndexMaintenance
getDuplicatedIndexes, getForeignKeysNotCoveredWithIndex, getIndexesWithBloat, getIndexesWithNullValues, getIntersectedIndexes, getInvalidIndexes, getPotentiallyUnusedIndexes, getTablesWithBloat, getTablesWithMissingIndexes, getTablesWithoutPrimaryKey
-
-
-
-
Constructor Detail
-
IndexMaintenanceImpl
public IndexMaintenanceImpl(@Nonnull PgConnection pgConnection)
-
-
Method Detail
-
getInvalidIndexes
@Nonnull public java.util.List<Index> getInvalidIndexes(@Nonnull PgContext pgContext)
Returns invalid (broken) indexes to be deleted or re-indexed on current host with the specified schema.- Specified by:
getInvalidIndexes
in interfaceIndexMaintenance
- Parameters:
pgContext
-PgContext
with the specified schema- Returns:
- list of invalid indexes
- See Also:
Index
-
getDuplicatedIndexes
@Nonnull public java.util.List<DuplicatedIndexes> getDuplicatedIndexes(@Nonnull PgContext pgContext)
Returns duplicated (completely identical) indexes (candidates for deletion) on current host.- Specified by:
getDuplicatedIndexes
in interfaceIndexMaintenance
- Parameters:
pgContext
-PgContext
with the specified schema- Returns:
- list of duplicated indexes
-
getIntersectedIndexes
@Nonnull public java.util.List<DuplicatedIndexes> getIntersectedIndexes(@Nonnull PgContext pgContext)
Returns intersected indexes (partially identical, candidates for deletion) on current host.- Specified by:
getIntersectedIndexes
in interfaceIndexMaintenance
- Parameters:
pgContext
-PgContext
with the specified schema- Returns:
- list of intersected indexes
-
getPotentiallyUnusedIndexes
@Nonnull public java.util.List<UnusedIndex> getPotentiallyUnusedIndexes(@Nonnull PgContext pgContext)
Returns potentially unused indexes (candidates for deletion) on current host.- Specified by:
getPotentiallyUnusedIndexes
in interfaceIndexMaintenance
- Parameters:
pgContext
-PgContext
with the specified schema- Returns:
- list of potentially unused indexes
-
getForeignKeysNotCoveredWithIndex
@Nonnull public java.util.List<ForeignKey> getForeignKeysNotCoveredWithIndex(@Nonnull PgContext pgContext)
Returns foreign keys without associated indexes (potential performance degradation) on current host.- Specified by:
getForeignKeysNotCoveredWithIndex
in interfaceIndexMaintenance
- Parameters:
pgContext
-PgContext
with the specified schema- Returns:
- list of foreign keys without associated indexes
-
getTablesWithMissingIndexes
@Nonnull public java.util.List<TableWithMissingIndex> getTablesWithMissingIndexes(@Nonnull PgContext pgContext)
Returns tables with potentially missing indexes (potential performance degradation) on current host.- Specified by:
getTablesWithMissingIndexes
in interfaceIndexMaintenance
- Parameters:
pgContext
-PgContext
with the specified schema- Returns:
- list of tables with potentially missing indexes
-
getTablesWithoutPrimaryKey
@Nonnull public java.util.List<Table> getTablesWithoutPrimaryKey(@Nonnull PgContext pgContext)
Returns tables without primary key on current host.Tables without primary key might become a huge problem when bloat occurs because pg_repack will not be able to process them.
- Specified by:
getTablesWithoutPrimaryKey
in interfaceIndexMaintenance
- Parameters:
pgContext
-PgContext
with the specified schema- Returns:
- list of tables without primary key
-
getIndexesWithNullValues
@Nonnull public java.util.List<IndexWithNulls> getIndexesWithNullValues(@Nonnull PgContext pgContext)
Returns indexes that contain null values on current host.- Specified by:
getIndexesWithNullValues
in interfaceIndexMaintenance
- Parameters:
pgContext
-PgContext
with the specified schema- Returns:
- list of indexes with null values
-
getIndexesWithBloat
@Nonnull public java.util.List<IndexWithBloat> getIndexesWithBloat(@Nonnull PgContext pgContext)
Returns indexes that are bloated in the specified schema.Note: The database user on whose behalf this method will be executed have to have read permissions for the corresponding tables.
- Specified by:
getIndexesWithBloat
in interfaceIndexMaintenance
- Parameters:
pgContext
-PgContext
with the specified schema- Returns:
- list of bloated indexes
-
getTablesWithBloat
@Nonnull public java.util.List<TableWithBloat> getTablesWithBloat(@Nonnull PgContext pgContext)
Returns tables that are bloated in the specified schema.Note: The database user on whose behalf this method will be executed have to have read permissions for the corresponding tables.
- Specified by:
getTablesWithBloat
in interfaceIndexMaintenance
- Parameters:
pgContext
-PgContext
with the specified schema- Returns:
- list of bloated tables
-
-