My takeaways from DjangoCon EU 2025

https://news.ycombinator.com/rss Hits: 3
Summary

Here are some of the most interesting things I learned at DjangoCon EU 2025 in Dublin, Ireland, partially written with the help of AI: link to talks My list of the best talks are at the bottom. Me at DjangoCon EU 2025! Database How to lock DB rows from Django: select_for_update locks a row prior to making changes, ensuring data consistency in concurrent environments. Move to BigInt Primary Keys ASAP: Always use a BigInt (64 bits) or UUID for primary keys. If your table is nearing 2.1 billion entries (the 32-bit integer limit), you can use negative values to double the range, but this comes with caveats. Talk Partition DB Tables by Tenant: The PostgresPartitionedModel mixin helps partition data into separate PostgreSQL partitions based on a value, improving performance for large tables. see django-postgres-extra package for more details Github Save 99.8% on space in Postgres Indexes: Always explicitly set db_index on foreign keys. By default, foreign keys are indexed, but you can optimize further: PostgreSQL builds indexes for null values, but you can add a condition to an Index to dramatically reduce index size (up to ~99% smaller). # Partial index example class Restaurant(models.Model): restaurant_chain = models.ForeignKey(..., db_index=False) class Meta: indexes = [ models.Index( fields=["restaurant_chain"], condition=~models.Q(restaurant_chain=None), ), ] Write Performance Tests in Pytest: Write tests that load data into the DB and time how long views take to ensure good performance (or see regressions). Check Laptop vs Cloud Server IO Speed: If your DB/app is slower in the cloud, compare cloud disk speed with your laptop's disk speed to see if the bottleneck is hardware or I/O. TODO: Insert command that can do this (will need to find this one talks are posted on YouTube) TCP_NODELAY and Nagle's Algorithm: If you're experiencing a bottleneck of around 25 requests/sec or 40ms per call, it might be due to TCP_NODELAY or Nagle's algorithm. These can be disabled usin...

First seen: 2025-04-28 21:21

Last seen: 2025-04-28 23:21