test=# CREATE TABLE devices
test-# (device_id serial primary key,
test(# device_name varchar(50) unique);

test=# CREATE TABLE switches () inherits (devices);

test=# CREATE TABLE routers
test-# (routing_protocol varchar(10))
test-# inherits (devices);

test=# CREATE INDEX idx_router_id ON routers (device_id);
test=# CREATE INDEX idx_switch_id ON switches (device_id);
test=# CREATE INDEX idx_routing_protocol ON routers (routing_protocol);
test=# VACUUM ANALYZE ;
prev next