django-planet
Nov. 2, 2010

Django gotcha: concrete inheritance

in blog Jacob Kaplan-Moss
original entry Django gotcha: concrete inheritance

Since 1.0, Django’s supported model inheritance. It’s a neat feature, and can go a long way towards increasing flexibility in your modeling options. However, model inheritance also offers a really excellent opportunity to shoot yourself in the foot: concrete (multi-table) inheritance. If you’re using concrete inheritance, Django creates implicit joins back to the parent table on nearly every query. This can completely devastate your database’s performance. To refresh, if you’ve got models like: