Useful queries

A number of example queries dealing with specific tables can also be found at each table type documentation, see Database Tables.
And if you cannot find what you are looking for, please send us a message via the Contact form.

How to get redshifts and snapshot numbers for a simulation?

For each simulation, there is a table called redshifts, e.g. MDR1 Redshifts. This tables contains redshifts (zred) with their scale factor (aexp) and snapshot number (snapnum) of the simulation.
A query would look like this:

SELECT zred, snapnum, aexp FROM mdr1.redshifts

If you want to know which data is available for each redshift, then consult the availhalos tables for each simulation, e.g. MDR1 AvailHalos table. It contains a table with the snapshot numbers, redshifts and available halo data, like FOF- and BDM-catalogue, halo profiles etc. Consult the corresponding documentation for the possible columns.

SELECT  snapnum, fof FROM mdpl.availhalos
How to find the main branch of one FOF halo?
SELECT prog.* FROM mdr1.fofmtree AS prog,
( SELECT foftreeid, mainleafid FROM MDR1.FOFMtree WHERE fofid = 85000000000  ) AS descend  
WHERE prog.foftreeid BETWEEN descend.foftreeid AND descend.mainleafid
ORDER BY prog.foftreeid ASC

Replace the fofid 85000000000 by the fofid of the halo you are interested in (choose from the mdr1.fof table). See Merger trees for more information on the structure of merger trees in the database.

How to extract progenitors of BDM halos?

Unfortunately, it is not possible to do this directly, since there are no merger tree tables for BDM-catalogues available in the database.

The halos' bdmids of different timesteps are NOT related with each other, that link can only be established with a merger tree. Since we only have merger trees for FOF and Rockstar catalogues in the database, you could use e.g. the FOF merger tree and match BDM halos with their closest FOF halo.