track all Mysql queries in WAMP - wamp

I want to track how much time needed for my queries to be executed
I referred to this post but I get only the queries without the time.
It is possible that after using my web application for a wile,using select, update , insert queries (not from console but real web-application execution) I can get a summary like this output generated by SHOW PROFILES; command.
I am working with wamp mysql V5.5.24
Many thanks
Edit: I used triggers to track the update and insert statement following this method
I still have the problem how to track the select query.
any idea please?

This no longer works.
As of July 2013, you need:
general-log=1
general-log-file = "C:\wamp\logs\mysql_general.log"

Are you sure you are not getting execution times in your slow query log?
If you are just looking to optimize your queries (rather than checking the execution time of every single one), you can look at the mysql server status in phpmyadmin (assuming you kept it in your wamp server) as covered here. The full tutorial is paid, but the preview will get you into the server status page where phpmyadmin will point out problem areas for you.

Finaly I used the general log by setup WAMP server like this
[mysqld]
port=3306
long_query_time = 1
slow_query_log = 1
slow_query_log_file = "E:/wamp/logs/slowquery.log"
log = "E:/wamp/logs/genquery.log"
after that I used this tool (trial version) dbForge Studio where I can use a query profiler and I get the complete execution time.

Related

Is there a way to force Sitecore to sync MongoDB data with it's SQL database?

I am setting up Sitecore xDB and am trying to test exactly what info gets through the system for authenticated and non-authenticated users. I would like to be able to make a change and see the results quickly in Sitecore. I found the setting to lower session lifetime to 1 minute rather than 20. I have not found a way to just force Sitecore to sync with Mongo on demand or at least within 1-5 minutes rather than, what also appears to be about 20 minutes at the moment. Does it exist or is "rebuilding" the database explained here the only existing process?
See this blog post by Martina Welander for this and more good info about xDB sessions: https://mhwelander.net/2016/08/24/whats-in-a-session-what-exactly-happens-during-a-session-and-how-does-the-xdb-know-who-you-are/
You just need a utility page that calls System.Web.HttpContext.Current.Session.Abandon(). You may also want to redirect the user to a page that doesn't exist.
Update to address comment
My understanding is that once an xDB session has expired, processing should take place quickly. In the Sitecore.Analytics.Processing.Services.config file, the BackgroundService agent is set to run on an interval of 15 seconds by default.
You may just be seeing cached reporting data. Try clearing the cache using the /sitecore/admin/cache.aspx page. You could also decrease the defaultCacheExpiration setting for the reporting cacheProvider in the Sitecore.Analytics.Reporting.config file. The default is 10 minutes.

The request has exceeded the allowable time limit Tag: CFQUERY

The query returns only 4-5 rows. It takes less than 1 second to execute. I have trid increasing the timeout of both cfquery and cfsetting but not working. most of the time code runs successfully but i got this error after every 20-30 request. I am using sql server database. I know when you restart the cf server or db server timeout issue occurs sometimes but this error is comming without restarting of any service (cf or sql server). I think there should be some setting changes in cf server please suggest.
The request has exceeded the allowable time limit Tag: CFQUERY
The error occurred on line 180.
<CFQUERY NAME="Sections" DATASOURCE="abcd">
SELECT * FROM News_Sections where Section = 'Home' ORDER BY Page_order
</CFQUERY>
The likely problem here is going to be the database not ColdFusion. I have a couple of tips for you. First, using the MSSQL Activity Monitor check out blocks (as a wait type). If you see a block or a "head blocker" click on that item and it will show you the query (sometimes :).
Once you locate it, fixing the problem will involve indexing or changing the query (complex joins or sub-queries often have unexpected consequences).
You might have some luck using "WITH(nolock)" in the above query to allow for a dirty read (probably ok if you are just getting categories). You might also consider caching the above query using cachedwithin or placing it in the application scope. If it is just broad "home" categories that seems reasonable to me (though obviously I don't know your schema.
My final bit of advice is to examine the page on which the error takes place closely. Sometimes the line number is off a bit. If you have groups of queries together it may not be the query you think is erroring out but the one above it. It's not common but it can happen.
As was pointed out by Mr. Bracuk, this may not be a problem with your query. This error has to do with the setting in the CFAdmin for Request timeouts. It is the page that is loading that has experienced the timeout and thrown the error. When the timeout occurred it just happened to be processing your query.
So, while the query is a good place to start looking, make sure to examine the entire script when searching for the cause of the timeout.

Coldfusion cfquery realtime cfprogressbar

My function running query, its taking sometime depending on requested data. While query running, I want to show real query loading cfprogressbar & changing status/title while cfprogressbar doing progress. im still searching on google till now no luck all examples showing static time.
I was thinking if i can get real cfquery loading time & i'll pass that value to cfprogressbar. Please advise
coldfusion 11
windows 2012
cfprogressbar
cfquery
Unfortunately you can't show an accurate progress bar. The ColdFusion engine does not run your query, the database server runs your query and for that reason the ColdFusion engine does not know where your db server is at while running the query. You can show a 'spinner' if you want to let your user know that something is going on.

Rebuilding Reporting Database Sitecore 8

Whenever I try to run the reporting database rebuild I get the error "Exceeded the cut off date before clearing storage". Has anyone experienced this or know what it means?
First, to work through this make sure you attach a clean reporting database. Next, make sure that the SQL user account has the db_owner role for both reporting databases. Lastly, and while not necessarily required, I prefer to purge everything from the sitecore_analytics_index folder (in your data\indexes folder).
The other option is to change the TimeToClearStorage setting as per this Sitecore article: https://doc.sitecore.net/sitecore_experience_platform/80/xdb_configuration/walkthrough_rebuilding_the_reporting_database
Specifically:
In the latest version of Sitecore xDB, the primary SQL Server reporting database contains some additional marketing definition tables that you need to copy to the secondary reporting database. When you run the rebuild reporting database page ensure that you allow more time for the clear storage process while these tables are being copied.
The default time to clear storage setting is 1 minute. Change this setting to a time interval appropriate for your Sitecore solution, for example, 10 minutes.
To change the TimeToClearStorage setting:
Open the Sitecore.Analytics.Processing.Aggregation.config file.
Change the TimeToClearStorage setting to an appropriate time. For example 10 minutes.
<reportingStorageManagertype="Sitecore.Analytics.Aggregation.History.ReportingStorageManager"singleInstance="true">
<TimeToClearStorage>0.00:01:00</TimeToClearStorage>
I set mine to 20 minutes.
1) Like Marco said you can change TimeToClearStorage
2) Make sure db_owner role is there for secondary (primary usually have this)
3) Then this will go through.. but later if it pauses for WaitReadyToReceiveData then you might need to do some manual updations as mentioned here .
4) After some time you should see it in 'completed' status.

Django models query result is not accurate

Hi I have some problems that has been bothering me for a week. I am running Selenium testing scripts on my dev machine, and in my test I would call simple script to delete accounts by their sub domain names:
for a in Account.objects.filter(domain = sub_domain):
a.delete()
The problem is that the query to find all such accounts are not returning correct results after the first time it is run (I use this query to clean up the database before each test). When I set a break point at this point, I can see the query return 0 records, even though in the database it has one record. I also set up mysql query log to see the actual query Django sent to mysql, and the query looks good, and will return correct result if I copy and paste to mysql command shell.
What am I missing? Why Django model query does not give me the correct result? MySQL is using InnoDB engine in case that makes any difference.
Transactions. Do a COMMIT in the shell.
This is a recurring problem, so I'm doing a shameless plug with a question in which I described details of the problem:
How do I deal with this race condition in django?