Quick clever idea I saw

Someone at work just pasted in some code that was locking two tables for write, inserting all of one table’s data into another, then making a trigger to keep them in sync in the future after inserts, and then unlocking the tables.

Someone else suggested just making the trigger first, and then replacing all of the data from the first table into the new one. Using replace means that some of the data may be double-copied, but there’s no table-level write locks used — pretty cool.

Also, we’ve been talking about hypergraphs, which are a little confusing. They’re graphs, but instead of each vertex having multiple edges and each edge running between two vertices, each vertex can have multiple edges and each edge can have more than two vertices! I ran into them once before, and still don’t quite understand how that situation even was a hypergraph.

Leave a Reply

Your email address will not be published.