3 ms·
MS SQL Server for instance comes with its own profiler. You can look for slow queries, then try to understand why by getting the query execution plan. You can a
by partycoder 10y ago
MS SQL Server for instance comes with its own profiler.
You can look for slow queries, then try to understand why by getting the query execution plan. You can alternatively also look for queries with a high standard deviation, which can hint of queries that get slower as there are more rows associated with a user.
Once you have the execution plan, you can either optimize the query, optimize the schema (add indices), or simply optimize the application (e.g: narrow the scope of the query, reduce call count). That however, won't allow you to horizontally scale.
The only realistic way to horizontally scale is sharding. Replication will slow down your writes as more machines are added and that simply does not scale. Using the same database for everything and everyone is a lousy way to go. Eventually you will need to keep things on different machines at some point.
Then, don't put large blobs into a database and store just the blob IDs in your database. Use another data store for that. Analytics, logging, etc doesn't belong into an OLTP database. Use another database for that not your OLTP one.
- 6DM 10y agoI tried analyzing execution plans for a fairly large stored procedure. I only needed to do it a few times. Everytime resulting in the DBA informing me that they've already analyzed that before and it was understandable why I couldn't make any real headway. Side note I found a free pdf for analyzing execution plans in this stackoverflow answer (toward the bottom): http://stackoverflow.com/a/7359705/834579 http://stackoverflow.com/a/7359705/834579 Would you consider logging user actions, for reporting in website, as something that should be stored else where? In one case I can think of the table had about 7 million records, but nobody seemed concerned about it.
- partycoder 10y agoIf it's just a log then you can "merge on write" (nosql) instead of "merge on read" (join),