Navigation
Catalog: Farseer.net Lightweight Open source Framework Catalog
Previous: Farseer.net lightweight open Source Framework intermediate article: database switching
Next: Farseer.net Lightweight Open source Framework intermediate: Explore ORM (Mapping)
Many times, we want to know what SQL statements were executed during the execution of the project, or how many databases were accessed in a single page. So that we provide some direction in the optimization.
For example, in some cases, the author can confidently think that the page is simple, and it is estimated that it will be 5 SQL statements at most. But after opening the SQL report only to frighten dumbfounded, dozens of SQL, see is striking.
Or sometimes, colleagues find me and say, how the page executes so slowly, I usually let him go to see the SQL Execution report, an open, found a page executed hundreds of SQL. How fast can such a page go? In the loop to access the database, is to test the ability to withstand the database?
All right, the crap's done. Now say back to the serious thing, first of all, if you open the SQL report. The default farseer is to close the SQL report. Keep in mind that in a production environment (online environment) Please do not open this SQL report. Because it will directly affect your system performance. Open only in the development environment.
Turn on SQL Records
In ~/app_data/system.config , there is one:Iswritedblog is false by default, it is set to true. When this configuration file does not exist, the following project is executed, Farseer will check if the configuration file exists and will be created if it does not exist.
When opened, try running the next project again. You will find that there is an extra SQL folder in ~/app_data/. Yes, this is the SQL record that was generated during the run of the project.
This SQL log file will always be recorded. The physical file directory is stored according to the path accessed.
Let's take a look at what's logged in this SQL report:
It's all milliseconds. Unit Display
build : Farseer.net The time it takes to generate the SQL text.
gets : The time to commit the SQL Text (ADO) to the database, that is, the database execution time.
Conversion : The DataTable that gets the data is converted to list<users> conversion time.
With such a simple SQL report, you can get a clearer picture of how your project is performing.
Navigation
Catalog: Farseer.net Lightweight Open source Framework Catalog
Previous: Farseer.net lightweight open Source Framework intermediate article: database switching
Next: Farseer.net Lightweight Open source Framework intermediate: Explore ORM (Mapping)
Advertising time
QQ Group:116228666 (farseer.net Open source frame exchange) Please specify: Blog Park
Farseer.net is an ORM framework + Common tool + extension collection.
Farseer: Prophets and seers usually offer tricks and strategies in certain situations. Also hope that the framework can provide you with maximum convenience.
ORM: The English name is:object relational(relationship) Mapping(map)
Farseer.net's goal is: Quick start, rapid development, simple and convenient.
1 New 1 " Zhang San " }. Insert ()
Farseer.net Lightweight Open Source Framework Intermediate: SQL Execution Report