Database compatibility
-
Upload
pascal-louis-perez -
Category
Technology
-
view
1.174 -
download
1
description
Transcript of Database compatibility
![Page 1: Database compatibility](https://reader036.fdocuments.us/reader036/viewer/2022082603/54b94a414a7959e2078b45d7/html5/thumbnails/1.jpg)
Company Confidential - Wealthfront Inc.
Database compatibility(i.e. Application talking to a DB)
• Select statement– App. is reader, DB is writer
• Insert– App. is writer, DB is reader
![Page 2: Database compatibility](https://reader036.fdocuments.us/reader036/viewer/2022082603/54b94a414a7959e2078b45d7/html5/thumbnails/2.jpg)
Company Confidential - Wealthfront Inc.
DB: Rules of Engagement
• Adding a table: ✔• Removing a table: ✔– Table is unused
• Removing a column: ✔– Column is unused
• Adding a column: ✔– Nullable OR– Not-null with default value
• Renaming a column: ✖
![Page 3: Database compatibility](https://reader036.fdocuments.us/reader036/viewer/2022082603/54b94a414a7959e2078b45d7/html5/thumbnails/3.jpg)
Company Confidential - Wealthfront Inc.
DB: Dogfighting
• Table users with two columns id and value• Value is a percentage, stored as [0, 100]• Migrate to [0, 1] representation• Clustered servers talking to the DB• No downtime
![Page 4: Database compatibility](https://reader036.fdocuments.us/reader036/viewer/2022082603/54b94a414a7959e2078b45d7/html5/thumbnails/4.jpg)
Company Confidential - Wealthfront Inc.
DB: DogfightingReads id & valueWrites [0, 100] in value
create table users ( id int not null, value int not null);
![Page 5: Database compatibility](https://reader036.fdocuments.us/reader036/viewer/2022082603/54b94a414a7959e2078b45d7/html5/thumbnails/5.jpg)
Company Confidential - Wealthfront Inc.
DB: Dogfighting
alter table users modify value int, add value_dec decimal;
![Page 6: Database compatibility](https://reader036.fdocuments.us/reader036/viewer/2022082603/54b94a414a7959e2078b45d7/html5/thumbnails/6.jpg)
Company Confidential - Wealthfront Inc.
DB: DogfightingReads id & valueWrites [0, 100] in valueWrites [0, 1] in value_dec
![Page 7: Database compatibility](https://reader036.fdocuments.us/reader036/viewer/2022082603/54b94a414a7959e2078b45d7/html5/thumbnails/7.jpg)
Company Confidential - Wealthfront Inc.
DB: Dogfighting
update users set value_dec = value / 100 where value_dec is null;
![Page 8: Database compatibility](https://reader036.fdocuments.us/reader036/viewer/2022082603/54b94a414a7959e2078b45d7/html5/thumbnails/8.jpg)
Company Confidential - Wealthfront Inc.
DB: Dogfighting
Reads id & value_decWrites [0, 1] in value_dec
![Page 9: Database compatibility](https://reader036.fdocuments.us/reader036/viewer/2022082603/54b94a414a7959e2078b45d7/html5/thumbnails/9.jpg)
Company Confidential - Wealthfront Inc.
DB: Dogfighting
alter table users drop column value, modify value_dec decimal not null;
![Page 10: Database compatibility](https://reader036.fdocuments.us/reader036/viewer/2022082603/54b94a414a7959e2078b45d7/html5/thumbnails/10.jpg)
Company Confidential - Wealthfront Inc.
DB: Top Gun
• Table users with two columns id and value• Value is a percentage, stored as [0, 100]• Migrate to [0, 1] representation• Clustered servers talking to the DB• No downtime• No DDL change (value is decimal) NEW