4 ms·
What are the common use cases for this scenario?
by scwoodal 10y ago
What are the common use cases for this scenario?
- tyingq 10y agoTable prefixes? Running more than one instance of an application in a single database. You'll find it's supported in most php apps and frameworks. Wordpress, Drupal, Laravel, Magento, etc. Not just php either. Ruby/Rails Active Record, for example, supports it. And I imagine dynamic, variable bound table names are probably in every ORM in just about every language.
- DCoder 10y agoVariable table names can also be useful if you have poor man's partitioning – separate tables with historical data , like "logs_201610", "logs_201611", "logs_201612", etc. Another scenario I just thought of: your schema is more or less dynamic. For example, Drupal lets developers/site administrators create entities with custom fields, each field gets its own DB table, and to load an entity you need to SELECT * FROM node LEFT OUTER JOIN field_data_field_name_1 ON .. LEFT OUTER JOIN field_data_field_name_2 ON .. ...