Skip to content

rfc: information_schema#7965

Merged
nvb merged 1 commit intocockroachdb:masterfrom
nvb:nvanbenschoten/isRFC
Aug 2, 2016
Merged

rfc: information_schema#7965
nvb merged 1 commit intocockroachdb:masterfrom
nvb:nvanbenschoten/isRFC

Conversation

@nvb
Copy link
Copy Markdown
Contributor

@nvb nvb commented Jul 21, 2016

Support the information_schema specification.

Rendered preview: https://github.com/nvanbenschoten/cockroach/blob/nvanbenschoten/isRFC/docs/RFCS/information_schema.md


This change is Reviewable

@nvb nvb force-pushed the nvanbenschoten/isRFC branch from d37402a to 6b50712 Compare July 21, 2016 18:05
and as long as they add concrete value. An example here would be a column in the
`INFORMATION_SCHEMA.TABLES` table about column families. What other columns or tables would be
valuable CockroachDB-extensions to the `information_schema`?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The content of the table could also not be up-to-date (i.e. it could omit a table that was created but hasn't been discovered by the local node yet).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could it? The information_schema.tables table will be populated with a scan similar to

// getTableNames implements the SchemaAccessor interface.
, which should avoid issues like that.

@tbg
Copy link
Copy Markdown
Member

tbg commented Jul 21, 2016

Sounds reasonable to me. Thanks for including all the details on how other DBs actually implement that table - TIL.


Reviewed 1 of 1 files at r1.
Review status: all files reviewed at latest revision, 1 unresolved discussion, some commit checks failed.


Comments from Reviewable

@petermattis
Copy link
Copy Markdown
Collaborator

:lgtm:


Review status: all files reviewed at latest revision, 2 unresolved discussions, some commit checks failed.


docs/RFCS/information_schema.md, line 200 [r1] (raw file):

and as long as they add concrete value. An example here would be a column in the
`INFORMATION_SCHEMA.TABLES` table about column families. What other columns or tables would be
valuable CockroachDB-extensions to the `information_schema`?

Interleaved tables? STORING?


Comments from Reviewable

@tbg
Copy link
Copy Markdown
Member

tbg commented Jul 21, 2016

Review status: all files reviewed at latest revision, 2 unresolved discussions, some commit checks failed.


docs/RFCS/information_schema.md, line 200 [r1] (raw file):

Previously, petermattis (Peter Mattis) wrote…

Interleaved tables? STORING?

Column families?

Comments from Reviewable

@bdarnell
Copy link
Copy Markdown
Contributor

:lgtm:


Review status: all files reviewed at latest revision, 4 unresolved discussions, some commit checks failed.


docs/RFCS/information_schema.md, line 26 [r1] (raw file):

[documentation on the topic.](http://dev.mysql.com/doc/refman/5.7/en/information-schema.html#idm140648692050944)

More importantly, in order to perform schema reflection, a large majority of ORMs

Do you have a list of which ORMs use information_schema and which ones do not? It would be good to save that research somewhere so that we can gauge the importance of implementing the pg_* tables.


docs/RFCS/information_schema.md, line 143 [r1] (raw file):

follow MySQL's lead and turn `SHOW` statements into a wrapper around `information_schema`
queries. This will help eliminate duplicate implementations and simplify SHOW statement
handling significantly.

Should we consider removing/deprecating the SHOW commands completely, or are the information_schema queries verbose enough that the SHOW commands are useful shorthand?


Comments from Reviewable

@tbg
Copy link
Copy Markdown
Member

tbg commented Jul 23, 2016

#7974 should be able to use information_schema. I assume information_schema would magically only return whatever the user is allowed to see, right? These permissions issues deserve a little bit of comment.

@tbg
Copy link
Copy Markdown
Member

tbg commented Jul 23, 2016

Review status: all files reviewed at latest revision, 4 unresolved discussions, some commit checks failed.


docs/RFCS/information_schema.md, line 201 [r1] (raw file):

Previously, nvanbenschoten (Nathan VanBenschoten) wrote…

Could it? The information_schema.tables table will be populated with a scan similar to

// getTableNames implements the SchemaAccessor interface.
, which should avoid issues like that.

You're right. Same for databases, right (i.e. information_schema will never rely on gossipped info)?

Comments from Reviewable

@nvb nvb force-pushed the nvanbenschoten/isRFC branch from 6b50712 to 73af988 Compare July 23, 2016 23:11
@nvb
Copy link
Copy Markdown
Contributor Author

nvb commented Jul 23, 2016

Added a section on privileges to address @tschottdorf's comment. I'm a little shocked that SHOW statements don't already do this, but I guess multi-tenancy hasn't been a major focus yet.


Review status: 0 of 1 files reviewed at latest revision, 4 unresolved discussions, some commit checks pending.


docs/RFCS/information_schema.md, line 26 [r1] (raw file):

Previously, bdarnell (Ben Darnell) wrote…

Do you have a list of which ORMs use information_schema and which ones do not? It would be good to save that research somewhere so that we can gauge the importance of implementing the pg_* tables.

https://docs.google.com/spreadsheets/d/17A0EflPqI9yhargK0n4tSw2WogQuVc5YeK-VFmKvXHM presents a pretty good overview of respective usages of meta tables in ORMs.

docs/RFCS/information_schema.md, line 143 [r1] (raw file):

Previously, bdarnell (Ben Darnell) wrote…

Should we consider removing/deprecating the SHOW commands completely, or are the information_schema queries verbose enough that the SHOW commands are useful shorthand?

I'm tempted to say that we should maintain support for `SHOW` statements, because MySQL maintains both approaches and because they are more straightforward to use from a SQL shell than a verbose query on `information_schema`. Are there any good reasons to deprecate them, especially since they should simply map to IS queries?

docs/RFCS/information_schema.md, line 200 [r1] (raw file):

Previously, tschottdorf (Tobias Schottdorf) wrote…

Column families?

Done.

docs/RFCS/information_schema.md, line 201 [r1] (raw file):

Previously, tschottdorf (Tobias Schottdorf) wrote…

You're right. Same for databases, right (i.e. information_schema will never rely on gossipped info)?

Correct, nothing that I can think of should rely on gossipped info because by definition it would imply inconsistency across nodes. I don't think any introspective information about a specific node deserves to be present in the `information_schema`, because it would break the illusion of a consistently persisted, real table.

Comments from Reviewable

@tbg
Copy link
Copy Markdown
Member

tbg commented Jul 24, 2016

Reviewed 1 of 1 files at r2.
Review status: all files reviewed at latest revision, 4 unresolved discussions, some commit checks failed.


Comments from Reviewable

@tbg
Copy link
Copy Markdown
Member

tbg commented Jul 24, 2016

Review status: all files reviewed at latest revision, 3 unresolved discussions, some commit checks failed.


docs/RFCS/information_schema.md, line 143 [r1] (raw file):

Previously, nvanbenschoten (Nathan VanBenschoten) wrote…

I'm tempted to say that we should maintain support for SHOW statements, because MySQL maintains both approaches and because they are more straightforward to use from a SQL shell than a verbose query on information_schema. Are there any good reasons to deprecate them, especially since they should simply map to IS queries?

We're trying to be Postgres-flavor, so wouldn't we really want to support `\l`, ... etc? No strong opinion on my part, just curious.

Comments from Reviewable

@petermattis
Copy link
Copy Markdown
Collaborator

Review status: all files reviewed at latest revision, 4 unresolved discussions, some commit checks failed.


docs/RFCS/information_schema.md, line 143 [r1] (raw file):

Previously, tschottdorf (Tobias Schottdorf) wrote…

We're trying to be Postgres-flavor, so wouldn't we really want to support \l, ... etc? No strong opinion on my part, just curious.

I'd like to be careful about us "trying to be a Postgres-flavor". I prefer to think we're targeting standard SQL and looking to Postgres as the best guide from the open source world. But where the standard is silent (e.g. extensions for a SQL shell), we should take note of Postgres but not be bound by it.

Comments from Reviewable

Support the `information_schema` specification.
@nvb nvb force-pushed the nvanbenschoten/isRFC branch from 319071f to f4bc2f6 Compare August 2, 2016 18:34
@nvb nvb merged commit bbf106e into cockroachdb:master Aug 2, 2016
@nvb nvb deleted the nvanbenschoten/isRFC branch August 2, 2016 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants