The UCAC2 catalogue

Assuming you have SID installed, let’s add to the original ucac2_initial catalogue a HEALPix depth 8 index:

ALTER TABLE ucac2_initial ADD COLUMN healp8 INT UNSIGNED NOT NULL;
UPDATE ucac2_initial SET healp8 = HEALPLookup(1, 8, RAmas/3.6e6, DECmas/3.6e6);
ALTER TABLE ucac2_initial ADD KEY (healp8);

And lets perform some sky region queries:

CALL SID.SelectCircleHEALP ('', '*', 'mpe2018db.ucac2_initial', 'healp8',  8, 'RAmas/3.6e6', 'DECmas/3.6e6', 188, -3, 10, 'LIMIT 10');

CALL SID.SelectRectHEALP ('myregion', 'RAmas, DECmas, Amm', 'mpe2018db.ucac2_initial', 'healp8',  8, 'RAmas/3.6e6', 'DECmas/3.6e6', 188, -3, 30, 20, '');
SELECT * FROM SID.myregion;

CALL SID.SelectCircleHEALP ('myregion', 'RAmas/3.6e6 as ra, DECmas/3.6e6 as de, Amm/1e3 as mag', 'mpe2018db.ucac2_initial', 'healp8',  8, 'RAmas/3.6e6', 'DECmas/3.6e6', 188, -3, 30, '');
SELECT * FROM SID.myregion;