[Django]-Django, is filtering by string faster than SQL relationships?

4👍

Performance is not an issue here as noted by Dirk; as soon as a column is indexed, the performance difference between data types should be negligible when compared to other factors. Here’s a related SO question for more perspective.

What you should take care of is to prevent the duplication of data whose integrity you then would have to take care of on your own instead of relying on well-tested integrity checks in the database.

Another aspect is that if you do have relations between your data, you absolutely should make sure that they are accurately represented in your models using Django’s relationships. Otherwise there’s really not much point in using Django’s ORM at all. Good luck!

Leave a comment