I'm finding it strange to have these two tables separate, but as there is no description of the case you might even need it. By the name and structure of the tables something tells me that it does not have to.
If you want an action in a table to trigger action in another table, you must use triggers . But if there is only one table or need it:)
The primary key should never be changed in the database. It does not matter that there will be holes. The only exception is if you create a routine that modifies all references to it throughout the database and can ensure that these keys were not used anywhere outside the DB. But I would not do it. virtually zero benefits and there are risks.
What you call index is this key, index is a set of keys.
Trying to do what you are looking for will not make the database faster, that is micro-optimization, and those that do not bring gains. You have a chance to get worse.
To tell the truth in most scenarios I know nothing should be deleted effectively unless the person has a strategy for how to do this correctly.
Even though I wanted to do, I do not see the link between one table and another. If it is id
then you do not really need two tables and then the question description is wrong.
To model right, create the right indexes, make the right queries, configure the server correctly, make the application the right way, and the architecture of the solution is adequate, make tests, analyze the usage, see the bottlenecks, all this will have performance.