I'm working on a blogging website using a django server. In my model, I have the following code:
class PopularBlog(Blog):
class Meta:
ordering = ["-date_created", "-num_likes"]
proxy = True
Basically, date_created
never changes for a Blog. However, num_likes
might change pretty frequently.
Is the PopularBlog table modified every time when any blog's num_likes
is updated? How is the performance?
This is not a question about Django, but a question about databases. StackOverflow isn't really the place to go into the ins and outs of database indexes, but you should at least be aware that this is exactly the sort of thing that databases are good at. Just updating a single row of a table is nothing, and even if you've defined an index on the num_likes
column it'll be updated extremely quickly unless you have millions of records.