Ramblings

Ramblings which occasionally resemble reality. This is the blog of Stewart Smith.

Main menu

Skip to primary content
Skip to secondary content
  • Home
  • Bio
  • Contact

Post navigation

← Previous Next →

Drizzle metadata tables

Posted on 08/02/2011 by Stewart Smith

Giuseppe has a great post about the Evolution of MySQL metadata, and I thought I’d have a look at what we have in Drizzle. It’s pretty easy to work out how many tables are in each schema, we just query the standard INFORMATION_SCHEMA.TABLES view:

drizzle> select table_schema,count(table_name)
    ->  from information_schema.tables
    -> group by table_schema;
+--------------------+-------------------+
| table_schema       | count(table_name) |
+--------------------+-------------------+
| DATA_DICTIONARY    |                53 |
| INFORMATION_SCHEMA |                20 |
+--------------------+-------------------+
2 rows in set (0 sec)

In Drizzle it’s important to note that there is a differentiation between SQL Standard INFORMATION_SCHEMA tables (found in the INFORMATION_SCHEMA schema) and the extensions and extra information available from Drizzle that is Drizzle specific (found in DATA_DICTIONARY). Since I know that the PostgreSQL version I have on my laptop (8.4) also implements INFORMATION_SCHEMA, I can run this query there as well:

stewart=# select table_schema,count(table_name)
 from information_schema.tables
 group by table_schema;
    table_schema    | count
--------------------+-------
 information_schema |    55
 pg_catalog         |    78
(2 rows)

If we had written the query to the Drizzle DATA_DICTIONARY tables, it only may have been portable – and as we can see, certainly wouldn’t have run unmodified on PostgreSQL. Personally, I really like this feature, and wish more systems did something like it.

This entry was posted in drizzle and tagged data_dictionary, drizzle, INFORMATION_SCHEMA, metadata, mysql, postgresql by Stewart Smith. Bookmark the permalink.
Logging In...

Profile cancel

Sign in with Twitter Sign in with Facebook
or

Not published

Proudly powered by WordPress