Installing SID

SID is a set of tools aimed at implementing a powerful indexing system for astronomical catalogues and other data with spherical coordinates, stored into MySQL / MariaDB databases. SID is able to use both HTM and HEALPix pixelization schemas and it allows very fast query execution even on billion-row tables. See the GitHub site.
If you have DIF installed, then this installation is optional, though they can co-exist.

Download the library from the GitHub site. If you have git installed (suggested), then, from a convenient directory like Downloads, run:

git clone https://github.com/lnicastro/SID.git

Be sure the MySQL/MariaDB development files and cmake are installed on your machine. The GNU gcc compiler could be needed. If you have MacPorts or Homebrew installed then it should be already in place.

To compile and install the library on Linux:

cd SID
mkdir Build
cd Build
cmake ..
make
sudo make install

In case of compilation errors on Mac OS, try using the appropriate path for the GNU gcc / c++:

cd SID
mkdir Build
cd Build
cmake -DCMAKE_C_COMPILER=/opt/local/bin/gcc -DCMAKE_CXX_COMPILER=/opt/local/bin/c++ ..
make

sudo make install

Now you are ready to load into MySQL the functions and procedure provided by SID.

UDFs installation

First import the SID User Defined Functions (UDFs) into MySQL (as user root):

  shell> cd ../sql
  shell> mysql -u root -p
  mysql> source sidinstall.sql

Note that in addition to the installation of the functions, the SID databases is created. It is primarily used to store SID specific SQL functions and procedures, but can be used also to store any user table.

Test installation

1. As user root import into MySQL the pre-defined SID demo procedures (also in the directory sql):

  mysql> use SID;
  mysql> source sid-demo.sql

and now grant execution for the created procedures:

-- just a check to see the functions are there
SELECT SPECIFIC_NAME,ROUTINE_SCHEMA,ROUTINE_NAME,ROUTINE_TYPE FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_name like 'Select%';
-- Note the names and the type.
-- Now we give grants to the user mpeusr.

grant SELECT on SID.* to mpeusr@localhost;

grant execute on procedure SID.SelectRectHTM to mpeusr@localhost;
grant execute on procedure SID.SelectCircleHEALP to mpeusr@localhost;
grant execute on procedure SID.SelectRectHEALP to mpeusr@localhost;

These grants could also be useful:

grant execute on procedure SID.CreateCircle_HTM to mpeusr@localhost;
grant execute on procedure SID.CreateRect_HTM to mpeusr@localhost;
grant execute on procedure SID.CreateCircle_HEALP to mpeusr@localhost;
grant execute on procedure SID.CreateRect_HEALP to mpeusr@localhost;

2. If not done yet, download/copy the reduced version of the ASCC 2.5 star catalogue in the Data working directory. Similarly for the Tycho-2 catalogue.