I have three entities which are "Addressable" (can have an Address):
Delivery Points
Customers
Distribution Centers
Every Addressable entity also is Geolocatable (has latitude and longitude), but i have entities that are Geolocatable but not Addressable, like Track Points and Route Points (an ordered sequence of lat and lngs).
What is the best way (please take performance in account, as some tables may have millions of rows), to achieve this with doctrine 2 (using Symfony2 and YAML mapping)?
My question is: what is the best approach for this problem? mapped supperclasses? single table inheritance? multi table inheritance? I didn't get which one is best for this by reading doctrine's docs.
I'm using PostgreSQL, if that matters.
The fastest option would be not using any table-inheritance at all and mapping all entities to distinct tables but if you want to use table-inheritance for some reason ...
single table inheritance is faster by architecture as there are less joins in the queries ... see this article to get an idea of how table inheritance works/looks ...
metadata is usually cached so there will not be a noticable performance impact between using mapped-superclasses or providing complete mappings (which would be bad in terms DRY) for every single of your entities.
The real performance gain will come from optimizing your queries and caching these and their results.