I have a table that holds the card, which is described by the following attributes
Database: Oracle 11g
They USER_TABLE to many (- <) CARD
CARD
id NUMBER PK
name VARCHAR
card_number NUMBER
USER_ID NUMBER USER_TABLE FK
Probably the tables will store about 20 million records
In my application user (from the table USER_TABLE) is able to determine the order assigned to each card.
Cards by downloading through the query: SELECT * FROM CARD WHERE USER_ID =?
My idea to solve the problem of order:
1st
ORDER NUMBER adding an attribute that will determine the order. Unfortunately, after changing the order I have to update all user records.
2nd The addition of two attributes PREF NUMBER NEXT NUMBER. I Gain a little on operations where the card position changes by one, but in the worst case I update all the user cards.
My questions are as follows:
How to eliminate the problem of blockages in table?
Is there any better way to solve this problem?
Make your ordering id a FLOAT. Then you can modify the value to be between two pre-existing values.
MyDataID 3 has now moved from being 3rd to being 2nd. And I have not had to update the myOrder values for any other records.