The SDSS catalog data is stored in a commercial relational database management system (DBMS) - Microsoft's SQL Server. The data is therefore organized in several 2-dimensional tables. The tables and their relationships to each other are referred to as the schema in database jargon.
There are 3 different types of data in the tables - imaging data is in the photo group of tables, spectroscopic and tiling data is in the spectro tables, and other data such as documentation or other information about the photo and spectro data, i.e. metadata, is in the meta tables. Some tables are also created specifically for speef or convenience, for example the SpecPhotoAll table, which contains a pre-computed join of relevant fields in the PhotoObjAll and SpecObjAll tables.
The important tables are described below, along with the views that are currently defined on each table. A view is a subset of the corresponding table that can be used instead of the table - in other words it is a virtual table. A view is usually faster than using the base table, since it only loads a subset of the objects, but more importantly, the views we have defined on the tables select only the objects that are important for science, and they filter out non-science objects such as sky, QA or defective observations. As such, even though we list the base tables for completeness below, in the vast majority of the cases, you should use the views defined on the tables instead of the tables themselves, e.g. use the PhotoObj and SpecObj views for science instead of the PhotoObjAll and SpecObjAll tables.
There are two main datasets in the SDSS catalog archive server -
the BEST and TARGET datasets that are contained in separate databases. Each
contains different reprocessings of the same raw data:
Both databases have the identical schema (tables), but different
data. The BESTDR7 database also contains the spectroscopic and
tiling data, whereas the TARGDR7 database only contains imaging
data. The vast majority of queries are run on the BESTDR7
database.
To choose a database other than the default BESTDR7 in your query, you must specify it as <dbname>..<tablename>, e.g., TARGDR7..PhotoObj:
SELECT TOP 10 objid,ra,dec FROM TARGDR7..PhotoObjPlease see the SQL Intro page for further help with SQL queries.
We have build a spatial indexing scheme called the Hierarchical Triangular Mesh (HTM) that spatially decomposes the region of the sky that is covered by the SDSS data and enables much faster spatial searches of the data by coordinate cuts.
In addition to the HTM, which is an overall indexing scheme for multidimensional spatial data, the DBMS itself has the capability to define indices for fast searches on each table. We have defined indices on all the major tables.
An index is a tree representation of a subset of the columns in a table that enables much faster searches of the table (compared to sequential scans of the table data) when constraints involving those columns are included in the query. All tables have an index on their primary key (unique row identifier), but the larger tables have indexes in addition to the primary key index. In all there are 3 kinds of indices:
View Name | Contents | Description |
PhotoAuxAll | View for PhotoAuxAll for backward compatibility with DR5. | It selects the required columns from PhotoObjAll. |
PhotoAuxAll | View for PhotoAuxAll for backward compatibility with DR5. | It selects the required columns from PhotoObjAll. |
PhotoAuxAll | View for PhotoAuxAll for backward compatibility with DR5. | It selects the required columns from PhotoObjAll. |
PhotoAuxAll | View for PhotoAuxAll for backward compatibility with DR5. | It selects the required columns from PhotoObjAll. |
PhotoAuxAll | View for PhotoAuxAll for backward compatibility with DR5. | It selects the required columns from PhotoObjAll. |
PhotoAuxAll | View for PhotoAuxAll for backward compatibility with DR5. | It selects the required columns from PhotoObjAll. |
PhotoAuxAll | View for PhotoAuxAll for backward compatibility with DR5. | It selects the required columns from PhotoObjAll. |
PhotoFamily | These are in PhotoObj, but neither PhotoPrimary or Photosecondary. | These objects are generated if they are neither primary nor secondary survey objects but a composite object that has been deblended or the part of an object that has been deblended wrongfully (like the spiral arms of a galaxy). These objects are kept to track how the deblender is working. It inherits all members of the PhotoObj class. |
PhotoObj | All primary and secondary objects in the PhotoObjAll table, which contains all the attributes of each photometric (image) object. | It selects PhotoObj with mode=1 or 2. |
PhotoPrimary | These objects are the primary survey objects. | Each physical object on the sky has only one primary object associated with it. Upon subsequent observations secondary objects are generated. Since the survey stripes overlap, there will be secondary objects for over 10% of all primary objects, and in the southern stripes there will be a multitude of secondary objects for each primary (i.e. reobservations). |
PhotoSecondary | Secondary objects are reobservations of the same primary object. |
Index Type | Key or Field List |
primary key | objID |
foreign key | Field(fieldID) |
covering index | mode, cy, cx, cz, htmID, type, flags, status, ra, dec, u, g, r, i, z, rho |
covering index | htmID, cx, cy, cz, type, mode, flags, status, ra, dec, u, g, r, i, z, rho |
covering index | htmID, run, camcol, field, rerun, type, mode, flags, status, cx, cy, cz, g, r, rho |
covering index | field, run, rerun, camcol, type, mode, flags, rowc, colc, ra, dec, u, g, r, i, z |
covering index | fieldID, objID, ra, dec, r, type, status, flags |
covering index | SpecObjID, cx, cy, cz, mode, type, flags, status, ra, dec, u, g, r, i, z, rho |
covering index | cx, cy, cz, htmID, mode, type, flags, status, ra, dec, u, g, r, i, z, rho |
covering index | run, mode, type, status, flags, u, g, r, i, z, Err_u, Err_g, Err_r, Err_i, Err_z |
covering index | run, camcol, rerun, type, mode, status, flags, ra, dec, fieldID, field, u, g, r, i, z |
covering index | run, camcol, field, mode, parentID, q_r, q_g, u_r, u_g, isoA_r, isoB_r, fiberMag_u, fiberMag_g, fiberMag_r, fiberMag_i, fiberMag_z |
covering index | run, camcol, type, mode, cx, cy, cz |
covering index | ra, [dec], type, mode, flags, u, g, r, i, z, psfMag_u, psfMag_g, psfMag_r, psfMag_i, psfMag_z, primTarget |
Index Type | Key or Field List |
primary key | objID |
foreign key | PhotoObjAll(objID) |
foreign key | Field(fieldID) |
covering index | mode, cy, cx, cz, htmID, type, flags, status, ra, [dec], modelMag_u, modelMag_g, modelMag_r, modelMag_i, modelMag_z, [size] |
covering index | htmID, cx, cy, cz, type, mode, flags, status, ra, [dec], modelMag_u, modelMag_g, modelMag_r, modelMag_i, modelMag_z, [size] |
covering index | htmID, run, camcol, field, rerun, type, mode, flags, status, cx, cy, cz, modelMag_g, modelMag_r, probPSF |
covering index | field, run, rerun, camcol, type, mode, flags, ra, [dec], modelMag_u, modelMag_g, modelMag_r, modelMag_i, modelMag_z |
covering index | fieldID, objID, ra, [dec], modelMag_r, type, status, flags |
covering index | SpecObjID, cx, cy, cz, mode, type, flags, status, ra, [dec], modelMag_u, modelMag_g, modelMag_r, modelMag_i, modelMag_z, [size] |
covering index | cx, cy, cz, htmID, mode, type, flags, status, ra, [dec], modelMag_u, modelMag_g, modelMag_r, modelMag_i, modelMag_z, [size] |
covering index | run, mode, type, status, flags, modelMag_u, modelMag_g, modelMag_r, modelMag_i, modelMag_z, modelMagErr_u, modelMagErr_g, modelMagErr_r, modelMagErr_i, modelMagErr_z |
covering index | run, camcol, field, rerun, type, mode, status, flags, ra, [dec], fieldID, modelMag_u, modelMag_g, modelMag_r, modelMag_i, modelMag_z |
covering index | ra, [dec], type, mode, flags, modelMag_u, modelMag_g, modelMag_r, modelMag_i, modelMag_z, psfMag_u, psfMag_g, psfMag_r, psfMag_i, psfMag_z, primTarget |
Index Type | Key or Field List |
primary key | segmentID |
foreign key | Chunk(chunkId) |
foreign key | StripeDefs(stripe) |
Index Type | Key or Field List |
primary key | fieldID |
foreign key | Segment(segmentID) |
covering index | field, camcol, run, rerun |
covering index | run, camcol, field, rerun |
Index Type | Key or Field List |
primary key | chunkID |
foreign key | StripeDefs(stripe) |
Index Type | Key or Field List |
primary key | objID, bin, band |
foreign key | PhotoObjAll(objID) |
Index Type | Key or Field List |
primary key | fieldID, bin, band |
foreign key | Field(fieldID) |
Index Type | Key or Field List |
primary key | objID, NeighborObjID |
foreign key | PhotoObjAll(objID) |
Index Type | Key or Field List |
primary key | objID1, objID2 |
foreign key | PhotoObjAll(objID) |
foreign key | MatchHead(objid) |
covering index | matchHead |
Index Type | Key or Field List |
primary key | objID |
foreign key | PhotoObjAll(objID) |
Index Type | Key or Field List |
primary key | plateID |
foreign key | TileAll(tile) |
covering index | htmID, ra, dec, cx, cy, cz |
View Name | Contents | Description |
SpecObj | A view of Spectro objects that just has the clean spectra. | The view excludes QA and Sky and duplicates. Use this as the main way to access the spectro objects. |
Index Type | Key or Field List |
primary key | specObjID |
foreign key | PlateX(plateID) |
covering index | htmID, ra, dec, cx, cy, cz, sciencePrimary |
covering index | BestObjID, objType, objTypeName, sciencePrimary, specClass, htmID, ra, dec, fiberMag_u, fiberMag_g, fiberMag_r, fiberMag_i, fiberMag_z |
covering index | specClass, zStatus, zWarning, z, sciencePrimary, primTarget, secTarget, plateId, bestObjID, targetObjId, htmID, ra, dec |
covering index | targetObjID, objType, objTypeName, sciencePrimary, specClass, htmID, ra, dec, fiberMag_u, fiberMag_g, fiberMag_r, fiberMag_i, fiberMag_z |
covering index | ra, [dec], specClass, plate, tile, z, zErr, zConf, fiberMag_r, primTarget, sciencePrimary, plateID, bestObjID |
View Name | Contents | Description |
SpecLine | A view of SpecLines objects that have been measured | The view excludes those SpecLine objects which have category=1, thus they have not been measured. This is the view you should use to access the SpecLine data. |
Index Type | Key or Field List |
primary key | specLineID |
foreign key | SpecObjAll(specObjID) |
covering unique index | specobjID, specLineID |
Index Type | Key or Field List |
primary key | specLineIndexID |
foreign key | SpecObjAll(specObjID) |
covering unique index | specobjID, speclineindexID |
View Name | Contents | Description |
Tile | A view of TileAll that have untiled=0 | The view excludes those Tiles that have been untiled. |
Index Type | Key or Field List |
primary key | tile |
foreign key | TilingRun(tileRun) |
covering unique index | tileRun, tile |
covering index | htmID, racen, deccen, cx, cy, cz |
View Name | Contents | Description |
TiledTarget | A view of TiledTargetAll objects that have untiled = 0 | The view excludes those TiledTarget objects that have been untiled. |
Index Type | Key or Field List |
primary key | targetID, tile |
foreign key | TileAll(tile) |
covering unique index | tile, targetID |
covering index | htmID, ra, dec, cx, cy, cz, objtype, untiled |
covering unique index | objType, targetID, tile |
View Name | Contents | Description |
TilingBoundary | A view of TilingGeometry objects that have isMask = 0 | The view excludes those TilingGeometry objects that have isMask = 1. See also TilingMask. |
TilingMask | A view of TilingGeometry objects that have isMask = 1 | The view excludes those TilingGeometry objects that have isMask = 0. See also TilingBoundary. |
Index Type | Key or Field List |
primary key | tilingGeometryID |
foreign key | TilingRun(tileRun) |
foreign key | StripeDefs(stripe) |
View Name | Contents | Description |
SpecPhoto | A view of joined Spectro and Photo objects that have the clean spectra. | The view includes only those pairs where the SpecObj is a sciencePrimary, and the BEST PhotoObj is a PRIMARY (mode=1). |
Index Type | Key or Field List |
primary key | specObjID |
foreign key | SpecObjAll(specObjID) |
covering index | objID, sciencePrimary, specClass, z, targetObjid, targetId |
covering index | targetObjID, sciencePrimary, specClass, z, objid, targetId |
covering index | targetID, sciencePrimary, specClass, z, objid, targetObjId |