Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Represent many-to-many rel between BGP updates and BGP hijacks with intermediate table #593

Open
vkotronis opened this issue Apr 6, 2021 · 0 comments
Labels

Comments

@vkotronis
Copy link
Member

Is your feature request related to a problem? Please describe.
Currently this is implicit on the site of the hijacks (is built in real time dynamically), and explicit on the site of BGP updates, albeit using a DB field that is a list of hijack keys. This creates many performance slow-downs when searching. The simplest way is to
use an intermediate table that stores the many-to-many rel referencing the primary keys/ids of the updates and hijacks. This requires heavy reformatting of code, but will have many benefits including the removal of ARRAY_REMOVE and array search actions, which may delay the system when the DBs are large.

Describe the solution you'd like
Intermediate table with foreign keys.

Describe alternatives you've considered
This is the most viable and DB-friendly change that we can induce, but requires single handling among the codebase to avoid issues.

Additional context
Arbitrary example with fkeys:

CREATE TABLE customers(
   customer_id INT GENERATED ALWAYS AS IDENTITY,
   customer_name VARCHAR(255) NOT NULL,
   PRIMARY KEY(customer_id)
);

CREATE TABLE contacts(
   contact_id INT GENERATED ALWAYS AS IDENTITY,
   customer_id INT,
   contact_name VARCHAR(255) NOT NULL,
   phone VARCHAR(15),
   email VARCHAR(100),
   PRIMARY KEY(contact_id),
   CONSTRAINT fk_customer
      FOREIGN KEY(customer_id) 
	  REFERENCES customers(customer_id)
	  ON DELETE CASCADE
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant