Shawn Wildermuth wrote a post Avoid Lazy Loading in ASP.NET where he argues that web applications should not make use of the lazy loading features in ORMs. His argument for not using lazy loading is because of potential problems, including increased web page latency, and extra load on the database server. He would rather avoid these pitfalls by avoiding using lazy loading. For reference, here's the documentation on lazy loading in EF Core. I agree with his position that lazy loading can lead to performance issues, but I disagree with the assertion that lazy loading should be avoided. My main issue is the advice to not use the lazy loading feature out right in web applications. I am not a fan of black listing a technology because of the potential issues. Instead, I'd rather see an explanation of the potential pitfalls, under what conditions, and how those problems would manifest themselves in web applications. I wrote up my comments on his post, but my comments got
Just wanted to share how to configure Postgres to capture query statistics using pg_stat_statements , including how often queries are run, how long they take to execute, along with a whole host of other useful information. First, you need to edit the Postgres configuration, adding pg_stat_statements to preshared libraries shared_preload_libraries = 'pg_stat_statements' pg_stat_statements.track = all After editing postgresql.conf, restart postgres. On Ubuntu sudo /etc/init.d/postgresql stop sudo /etc/init.d/postgresql start After restarting Postgres, you need to enabled the pg_stat_statements extension. You can enable it per database, or for all databases on the same Postgres server by installing on the postgres database. CREATE EXTENSION pg_stat_statements; Once pg_stat_statements is added to the preshared libraries and the extension is enabled, you can query pg_stat_statements to get useful information about running queries. SELECT query, sum(calls)