wiki:db/queries/056
Last modified 6 years ago Last modified on 02/01/2013 12:30:20 AM

Select time series for every object

It is possible we will manage to push enough information about time history into Object table to avoid querying Source table. For now, we are assuming querying Source table will be necessary.

There are several variations of this query:

Simply select time series for virtually every object:

SELECT * 
FROM   Source

Select time series for every object classified as star (or something else):

SELECT * 
FROM   Source
JOIN   Object USING (objectId)
WHERE  extendedParam < 0.2

Select time series for every variable object classified as star (or something else):

SELECT * 
FROM   Object
JOIN   VarObject USING (objectId
JOIN   _Object2Type USING (objectId) 
JOIN   ObjectType   USING (typeId)
WHERE  ObjectType.description = "star"

Of course returning all sources without any constraints to user is very impractical (and expensive) due to size, we will likely run out of temporary space, unless special arrangements are made.