Download presentation
Presentation is loading. Please wait.
Published byGrace Salazar Modified over 11 years ago
1
2003 May 24Clive Page Simple ADQL Enhancements Clive Page, AstroGrid Project University of Leicester, UK
2
2003 May 24Clive Page SELECT INTO newtable SQL designed to specify the final result – which is by default sent to standard output as a table in text form. Astronomers typically want to achieve a result incrementally, checking output of each step. –Need to be able to send results to a temporary table AstroGrid is working on MySpace – users storage area within DBMS or on external file. JHU is working on MyDB – similar concept in DBMS. Exact syntax for may have to be left as implementation-dependent until more experience is gained.
3
2003 May 24Clive Page EXPLAIN query Most DBMS support the EXPLAIN command, although not part of standard SQL. Very useful to inform user whether a given query will be –Evaluated by sequential scan – very slow for large table –Or use an index – fast even for a large table Results of EXPLAIN are entirely system-dependent –Perhaps this is acceptable at present, we may find a way to present results in a more uniform way later.
4
2003 May 24Clive Page TOP nrows Already specified in ADQL. Supported by most DBMS: DB2SELECT … WHERE … FETCH FIRST n ROWS ONLY SQL ServerSELECT TOP n … MySQLSELECT … WHERE… LIMIT n OracleSELECT … WHERE… ROWNUM <= n PostgreSQLSELECT … WHERE… LIMIT n Sybase-ASESET ROWCOUNT n; SELECT …
5
2003 May 24Clive Page TOP nrows - Semantics Syntax well defined, but semantics less so. When used with ORDER BY allows you to get the largest/smallest rows. But: with Sybase-ASE – the use of SET ROWCOUNT with ORDER BY results in selecting the first rows in the table and then sorting them – not usually what is required.
6
2003 May 24Clive Page Great Circle Distance Function When performing a cross-match it is very often desirable to have the distance between the matching sources as a column in the output Trigonometry to do this is a little complicated –Simplest expression has very poor accuracy with small angles, better to use haversine formula. Propose an additional function to simplify queries: –GCDIST(ra1, dec1, ra2, dec2) –Returns distance in units to be agreed, e.g. degrees, with arguments also in degrees.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.