freelawproject / courtlistener

A fully-searchable and accessible archive of court data including growing repositories of opinions, oral arguments, judges, judicial financial records, and federal filings.
https://www.courtlistener.com
Other
536 stars 148 forks source link

Move docket view count out of docket model #3346

Open mlissner opened 11 months ago

mlissner commented 11 months ago

Right now we tally a count to the docket table every time somebody views a docket. I'm sorry to say this is a bad idea. Looking up, locking, and then incrementing a row on a table of this size every time somebody loads the page is difficult. In fact, I've noticed that this query is our worst query according to AWS:

image

(You can't really tell, but it's the first one you see there.)

I'm not sure the best fix for this:

We should do something though, I'm afraid....

mlissner commented 1 month ago

By the way, the #917 will also fix this problem when we do it (at the cost of losing the accuracy of this stat).