20. TAP: the TAP schema

TAP services try to be self-describing about what data they contain. They provide information on what tables they contain in special tables in TAP_SCHEMA. Figure out what columns are in there by querying TAP_SCHEMA itself:

SELECT * FROM tap_schema.tables
WHERE table_name LIKE 'tap_schema.%'

Of the tables you get there, you’ll be most interested in tap_schema.tables and tap_schema.columns. From the former, you can obtain names and descriptions of tables, from the latter, about the same for columns.

To see what columns there are in tap_schema.columns, say:

SELECT * FROM tap_schema.columns
WHERE table_name='tap_schema.columns'

You’ll see there’s description, unit, and type. The indexed column says if the column is part of an index. While that information is, in general, not enough to be sure, on large tables querying against indexed columns can steer you clear of the dreaded “sequential scan”, which is when the database engine has to go through all rows (which is slow and may take hours for really large tables).

The ucd column is also interesting. UCD stands for Unified Content Descriptor and defines a simple semantic for physical quantities. For more information, see the UCD IVOA standard. To get an idea what UCDs look like, try:

SELECT DISTINCT ucd FROM tap_schema.columns ORDER BY ucd



How many tables are there on the server? How many columns? How many columns with UCDs starting with phot.mag?

Markus Demleitner, Hendrik Heinl

Copyright Notice