1. A system comprising: one or more processors; and program code including a query optimizer, the program code configured to be executed by the one or more processors to process a database query, the program code configured to: structure a database to have a plurality of tables having indexes to related rows and having keys with key values associated with particular rows; and delete rows in the database tables by deleting keys in indexes related to the rows in an order such that corresponding rows are deleted based on relation to the keys.