Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql: show all indexes on a database #37270

Closed
awoods187 opened this issue May 2, 2019 · 2 comments
Closed

sql: show all indexes on a database #37270

awoods187 opened this issue May 2, 2019 · 2 comments
Assignees
Labels
C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)

Comments

@awoods187
Copy link
Contributor

Describe the problem
We have a show index from table command but it'd be useful to see all of the indexes on a database with a show index from database or something similar. It could work something like this underneath the hood from MySQL:

SELECT
    DISTINCT TABLE_NAME,
    INDEX_NAME
FROM
    INFORMATION_SCHEMA.STATISTICS
WHERE
    TABLE_SCHEMA = `schema_name`;

And presents something like this:

  table_name | index_name | non_unique | seq_in_index | column_name | direction | storing | implicit
+------------+------------+------------+--------------+-------------+-----------+---------+----------+
  order      | primary    |   false    |            1 | o_w_id      | ASC       |  false  |  false
  order      | primary    |   false    |            2 | o_d_id      | ASC       |  false  |  false
  order      | primary    |   false    |            3 | o_id        | DESC      |  false  |  false
  warehouse  | primary    |   false    |            1 | w_id        | ASC       |  false  |  false
 history    | primary    |   false    |            1 | rowid       | ASC       |  false  |  false
@awoods187 awoods187 added the C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) label May 2, 2019
@rohany
Copy link
Contributor

rohany commented May 30, 2019

what kind of syntax would you be looking for in this command? It is unclear how to support in the parser both show indexes from <tablename> and show indexes from <databasename> due to conflicts. I was considering the syntax show indexes from database <databasename>, if this sounds good to you.

rohany added a commit to rohany/cockroach that referenced this issue Jun 3, 2019
Progress on the command requested in cockroachdb#37270.

Release note (sql change): Add frontend support for a command
that shows all indexes of all tables in a database.
rohany added a commit to rohany/cockroach that referenced this issue Jun 3, 2019
Progress on the command requested in cockroachdb#37270.

Release note (sql change): Add frontend support for a command
that shows all indexes of all tables in a database.
rohany added a commit to rohany/cockroach that referenced this issue Jun 3, 2019
Implements the feature requested in cockroachdb#37270.

Release note (sql change): Support a show indexes from database command
rohany added a commit to rohany/cockroach that referenced this issue Jun 3, 2019
Implements the feature requested in cockroachdb#37270.

Release note (sql change): Support a show indexes from database command
rohany added a commit to rohany/cockroach that referenced this issue Jun 3, 2019
Implements the feature requested in cockroachdb#37270.

Release note (sql change): Support a show indexes from database command
craig bot pushed a commit that referenced this issue Jun 3, 2019
37942: sql: Adding support for show indexes from database command r=rohany a=rohany

As requested in #37270, support for a show indexes from database command would be helpful. This PR includes support for the command in the parser. Future PR's will implement the functionality of the parsed results.

37977: cli: fix use of IPv6 addresses with RPC client commands r=knz a=knz

Fixes #33008.

(This was actually a regression of my doing, back from #28373. Didn't pick it up back then because we didn't have a test.)

Release note (bug fix): the `cockroach` command line utilities that
internally use a RPC connection (e.g. `cockroach quit`, `cockroach
init`, etc) again properly support passing an IPv6 address literal via
the `--host` argument.

Co-authored-by: Rohan Yadav <[email protected]>
Co-authored-by: Raphael 'kena' Poss <[email protected]>
@rohany
Copy link
Contributor

rohany commented Jun 3, 2019

Implement in #37942. You can use the command show indexes from database <database_name> to see this information now.

@rohany rohany closed this as completed Jun 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)
Projects
None yet
Development

No branches or pull requests

2 participants