Class IndexMaintenanceImpl

    • 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 interface IndexMaintenance
        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 interface IndexMaintenance
        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 interface IndexMaintenance
        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 interface IndexMaintenance
        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 interface IndexMaintenance
        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 interface IndexMaintenance
        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 interface IndexMaintenance
        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 interface IndexMaintenance
        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 interface IndexMaintenance
        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 interface IndexMaintenance
        Parameters:
        pgContext - PgContext with the specified schema
        Returns:
        list of bloated tables
      • getHost

        @Nonnull
        public PgHost getHost()
        Gets information about host in the cluster.
        Specified by:
        getHost in interface HostAware
        Returns:
        PgHost
        See Also:
        PgHost