Skip to content

Commit

Permalink
Add cntr column to best_brightest
Browse files Browse the repository at this point in the history
  • Loading branch information
albireox committed Jul 14, 2020
1 parent ecb35e7 commit 5682012
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions schema/sdss5db/catalogdb/best_brightest/best_brightest.sql
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,10 @@ ALTER TABLE catalogdb.best_brightest ADD PRIMARY KEY (designation);
CREATE INDEX CONCURRENTLY ON catalogdb.best_brightest (q3c_ang2ipix(ra_1, dec_1));
CLUSTER best_brightest_q3c_ang2ipix_idx ON catalogdb.best_brightest;
ANALYZE catalogdb.best_brightest;


-- Add a cntr column from AllWISE to allow joining without using the costly text field.
ALTER TABLE catalogdb.best_brightest ADD COLUMN cntr BIGINT;
UPDATE catalogdb.best_brightest b SET cntr = a.cntr
FROM catalogdb.allwise a WHERE a.designation = b.designation;
CREATE UNIQUE INDEX ON catalogdb.best_brightest (cntr);
8 changes: 8 additions & 0 deletions schema/sdss5db/catalogdb/foreignKeys.sql
Original file line number Diff line number Diff line change
Expand Up @@ -419,3 +419,11 @@ ALTER TABLE catalogdb.gaia_assas_sn_cepheids
ADD CONSTRAINT source_id_fk
FOREIGN KEY (source_id)
REFERENCES catalogdb.gaia_dr2_source (source_id);


-- best_brightest

ALTER TABLE catalogdb.allwise
ADD CONSTRAINT cntr_fk
FOREIGN KEY (cntr)
REFERENCES catalogdb.allwise (cntr);

0 comments on commit 5682012

Please sign in to comment.