Sleep partitioning

We have a requirement to delete data in the 200K range from the database daily. Our Java / Java EE application is based on Oracle DB and the Hibernate ORM tool.

We examined various options, for example

  • Hibernate Batch Processing
  • Stored procedure
  • Database sharing

Our database administrator offers database partitioning — the best way so we can easily recreate and discard a partitioned table every day. Now the problem is that we have 2 types of data that we want to delete every day, and the other that we want to save. Suppose that this data is stored in the Trade table. Now with the separation, we have 2 tables "Trade". We already have a Hibernate-based DAO level for retrieving / storing transactions from / to the database. When we decide to split the database, how can we control transactions in order to go to which of the two tables through sleep mode. Basically, I want the trades to be deleted before the end of the day to go to the split table and the transactions that I want to save in the main table. Please suggesthow is this possible with hibernate. We can add an additional column to determine which trades to delete, but how can we guarantee that these trades must go to a partitioned trading table using sleep mode.

, - , .

+3
2
+1

.

, , VolatileTrade, Trade ( ). " " ( 9.1.5 hibernate 3.3) .

( , : PersistentTrade VolatileTrade, , , , PersistentTrade ( Volatile), PersistentTrade, .)

, "" .

, fk Trade ( ) db.

, .

, , ( ). , , ( ).

truncate ?

0

Source: https://habr.com/ru/post/1743334/


All Articles