Advice on Searching with SkyServer
 
DR8 Help
 Start Here
 FAQ
 Glossary
 Cooking with Sloan
 Tool User Guides
 Contact Help Desk
 
 Searching SDSS-III
 SQL Tutorial
 SQL in SkyServer
 About the Database
 Table Descriptions
 Sample SQL Queries
 Schema Browser
 Searching Advice
 Query Limits
 
 Details of the Data
 Algorithms
 Data Publications
 API
Searching Advice

This page contains some general advice about how to search Sloan Digital Sky Survey data with SkyServer. The bottom of the page contains a form to practice searching, using the sample queries on this page.

Here are some things to keep in mind while searching SkyServer:

  1. For astronomical research, use the astronomers' interface to SkyServer rather than the public interface. You will have access to dedicated web servers that allow you to run queries that take longer and return more objects. To get to the astronomers' interface from the main page, click on the For Astronomers link.

  2. An excellent to learn SQL is to modify pre-existing SQL queries. Look at the Sample SQL Queries on SkyServer. There is a link to them under the Help menu.

  3. Use the Image List tool (opens in a new window) as a sanity check on your queries. Click on Use query to fill form in the left panel, then enter your query and click Submit. A table of results will appear; click Send to List. You will see thumbnail images of all the objects that matched your query. You can click on the thumbnails to go to the Navigate tool, or on the object names to go to the Explore tool.

    Remember that Image List queries are limited to 1,000 objects, and that the SELECT block must have the form SELECT name, ra, dec, where name can be anything you want. For example, this query uses the SDSS redshift as a name:

    SELECT z as name, ra, dec
    FROM specPhoto
    WHERE z BETWEEN 0.01 and 0.05
  4. If you're not sure how many objects a query is going to return, it's always a good idea to first do a "count" query first. A count query will return only the number of objects that match the query, and will not return the actual data. This will give you an idea of how long the query will take, so you don't find yourself waiting a lot longer than you expected to. Here is an example of such a query:

    SELECT count(*)
    FROM galaxy
    WHERE g < 18
  5. If a query takes much longer to run than you think it should, you should try it again later to see if the problem is load on the server. If it still runs slowly, look at the Optimizing Queries section of SkyServer's guide Using SQL with SkyServer.

  6. Be sure to exclude invalid values (unset or uncalculated quantities) as described in the Excluding Invalid Data Values section of SkyServer’s Using SQL with SkyServer. For example, the following query will exclude invalid magnitude data for the u magnitude:

  7. SELECT ra, dec, u, err_u
    FROM PhotoObj
    WHERE ra BETWEEN 180 and 181
    AND u > -9999 AND u < 20.0 -- instead of just "u < 20.0"
    AND err_u > -1000 AND err_u < 0.1 -- instead of just "err_u < 0.1"
  8. If you are running a query for photometric data, and you are searching for common parameters, consider using the PhotoTag table instead of the PhotoObj view. PhotoTag contains all the objects that PhotoObj contains, but has many fewer parameters for each object. Your query will run much faster. But remember that in PhotoTag, magnitudes are not referred to as [u, g, r, i, z], but as modelMag_[u, g, r, i, z].

  9. If your query returns a lot of output (more than a few thousand objects), it is generally not a good idea to let the browser render the output by selecting the HTML output format (default). You can try using the CSV output format instead. However, you're much better off using one of the other interfaces (Emacs, sqlcl or CasJobs - opens in new window) to get large numbers of objects.

  10. If you know you want to search for both photometric and spectroscopic objects, search on the SpecPhoto view. In SpecPhoto, the redshift is referred to as z and the magnitudes are referred to as modelmag_x (where x is the waveband). Here is a query to get magnitudes and redshifts from specPhoto:

    SELECT top 100 modelmag_u, modelmag_g, modelmag_r, modelmag_i,
           modelmag_z, z
    FROM SpecPhoto
    WHERE zConf > 0.35
  11. You can not make a graph with Excel in a CSV file. You must first save the file as an Excel XLS file.

 

Running these sample queries

The form below will let you practice some of these techniques using the sample queries given above. Click on the Query 1 - Query 4 buttons below to load these sample queries. Modify them if you like, and click Submit to run them. Click Reset to clear the textbox.

 

Format HTML XML CSV



Enter your SQL query in the text box. The query is limited to 10 minutes and 100,000 rows.