top of page

SQL developer for PostgreSQL

Открытая·2 пользователя

PostgreSQL: table index list


[EN]


The node displays a list of indexes built on the columns of the selected PostgreSQL table.


Menu

  • Copy name - copy the index name to the clipboard

  • Copy full name - copy the full index name to the clipboard

  • Reindex - generate command code for rebuilding the index

  • Get DDL - generate command code for creating an index

  • Create code [Drop] - generate a command code for deleting an index


Child nodes

  • Column - names of the columns on which the index is built

  • Primary - a flag indicating that the index is the primary key of the table

  • Unique - indicates whether the index is unique

  • Clustered - if true, the table was last clustered by this index

  • Valid - if true, the index can be used in queries.

  • Condeferrable - is the constraint deferrable?

  • Condeferred - is the constraint deferred by default?

  • Replident - if true, this index is selected as the "replica identifier"


select relname, oid, indisprimary, indisunique,

indisclustered, indisvalid, pg_get_indexdef,

pg_get_constraintdef, contype,

condeferrable, condeferred, indisreplident,

reltablespace,

string_agg(pg_get_indexdef_, ',') "col_lict"

from (

SELECT c2.relname,

c2.oid,

i.indisprimary::int,

i.indisunique::int,

i.indisclustered::int,

i.indisvalid::int,

pg_catalog.pg_get_indexdef(i.indexrelid, 0, true) "pg_get_indexdef",

pg_catalog.pg_get_constraintdef(con.oid, false),

contype,

condeferrable::int,

condeferred::int,

i.indisreplident::int,

c2.reltablespace,

pg_catalog.pg_get_indexdef(c2.oid, (information_schema._pg_expandarray(i.indkey)).n, false) "pg_get_indexdef_"

FROM pg_catalog.pg_class c, pg_catalog.pg_class c2, pg_catalog.pg_index i

LEFT JOIN pg_catalog.pg_constraint con ON (conrelid = i.indrelid AND conindid = i.indexrelid AND contype IN ('p','u','x'))

WHERE c.oid = $$TABLE_OID AND c.oid = i.indrelid AND i.indexrelid = c2.oid

ORDER BY i.indisprimary DESC, i.indisunique DESC, c2.relname) a

group by relname, oid, indisprimary, indisunique,

indisclustered, indisvalid, pg_get_indexdef, pg_get_constraintdef,

contype, condeferrable, condeferred, indisreplident, reltablespace


[RU]


Узел отображает список индексов построенных по колонкам выбранной таблицы PostgreSQL.


Меню
  • Copy name - скопировать в буфер обмена имя индекса

  • Copy full name - скопировать в буфер обмена полное имя индекса

  • Reindex - сформировать код команды на перестройку индекса

  • Get DDL - сформировать код команды на создание индекса

  • Create code [Drop] - сформировать код команды на удаление индекса

Дочерние узлы
  • Column - имена колонок по которым построен индекс

  • Primary - флаг указывающий, что индекс представляет из себя первичный ключ таблицы

  • Unique - указатель является ли индекс уникальным

  • Clustered - если true, таблица в последний раз кластеризовалась по этому индексу

  • Valid - если true, индекс можно применять в запросах.

  • Condeferrable - является ли ограничение откладываемым?

  • Condeferred - является ли ограничение отложенным по умолчанию?

  • Replident - если true, этот индекс выбран в качестве «идентификатора реплики»


select relname, oid, indisprimary, indisunique,

indisclustered, indisvalid, pg_get_indexdef,

pg_get_constraintdef, contype,

condeferrable, condeferred, indisreplident,

reltablespace,

string_agg(pg_get_indexdef_, ',') "col_lict"

from (

SELECT c2.relname,

c2.oid,

i.indisprimary::int,

i.indisunique::int,

i.indisclustered::int,

i.indisvalid::int,

pg_catalog.pg_get_indexdef(i.indexrelid, 0, true) "pg_get_indexdef",

pg_catalog.pg_get_constraintdef(con.oid, false),

contype,

condeferrable::int,

condeferred::int,

i.indisreplident::int,

c2.reltablespace,

pg_catalog.pg_get_indexdef(c2.oid, (information_schema._pg_expandarray(i.indkey)).n, false) "pg_get_indexdef_"

FROM pg_catalog.pg_class c, pg_catalog.pg_class c2, pg_catalog.pg_index i

LEFT JOIN pg_catalog.pg_constraint con ON (conrelid = i.indrelid AND conindid = i.indexrelid AND contype IN ('p','u','x'))

WHERE c.oid = $$TABLE_OID AND c.oid = i.indrelid AND i.indexrelid = c2.oid

ORDER BY i.indisprimary DESC, i.indisunique DESC, c2.relname) a

group by relname, oid, indisprimary, indisunique,

indisclustered, indisvalid, pg_get_indexdef, pg_get_constraintdef,

contype, condeferrable, condeferred, indisreplident, reltablespace


8 просмотров

О группе

Добро пожаловать в группу! Общайтесь с другими участниками, получайте обновления и делитесь фото и видео.

Участники

bottom of page