Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Databases in practice are surprisingly dangerous with multiple direct services, even with just readers. Your schema effectively becomes your protocol.

Need to add a column or perform delicate schema alterations? You run the risk of breaking dependents.

Have parts of your database that are sensitive (i.e. PII)? Your DB platform will need to reflect that to avoid arbitrary queries.

Is it possible to perform a query that recursively joins dozens of tables together on every entry? Your control is limited in how you could prevent them.

Who wrote that breaking change? Or, did someone's service get compromised? Hope you aren't sharing credentials for access among services.



The same caveats for managing backwards compatibility of HTTP routes/endpoints apply to managing database tables/columns.

> Need to add a column or perform delicate schema alterations? You run the risk of breaking dependents.

Create a stable-interface view over your unstable-interface underlying table, and query that view. Or version your tables (my_table_v1 -> my_table_v2) and create a new table for each breaking change.

> Have parts of your database that are sensitive (i.e. PII)? Your DB platform will need to reflect that to avoid arbitrary queries.

Use views to exclude PII fields or aggregate/hash them.

> Is it possible to perform a query that recursively joins dozens of tables together on every entry? Your control is limited in how you could prevent them.

Databases are designed for multitenancy, they have mechanisms to cap the resource usage of a query.

> Who wrote that breaking change? Or, did someone's service get compromised? Hope you aren't sharing credentials for access among services.

Not sure about MySQL, but Postgres has the pgaudit extension which handles provides this visibility for DML/DDL queries out of the box, as long as you create a DB user for each use case.


How do microservices solve these concerns better than a properly configured database?

> Hope you aren't sharing credentials for access among services.

Who would do this with a db and not with microservices?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: