473,549 Members | 2,610 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Performance question regarding GROUP BY...

1 New Member
We have a modestly large MySQL application (about 10,000,000 rows spread over 40+ tables). Most of our queries are very small and fast (single table or two-table joins with good keys and indexes).

However, we have a few queries that would be described as "long-running", and in particular, they use GROUP BY to aggregate some information. It seems that whenever the query has a GROUP BY, MySQL writes a temp table which then, in turn, puts all other queries into a locked state untl the long-running query finishes. We have tried to simplify the big queries, but as long as the GROUP BY is used, the query plan still shows the temp table being written and then in practice, the locking occurs (BTW, this uses MyISAM, but we tried InnoDB as well in a test, and although it didn't "lock" the other queries, instead it put them into "sleep" and the results were the same). This causes most of our short queries to wait for a long time, which is unacceptable.

It is perfectly okay for the long query to run a REALLY long time as long as it doesn't create an obstacle for the other queries. And this query does NO writing to the database tables themselves, it is only the temp table that is being written.

I have used many other databases and this situation (a temp table being written from a purely read-only query causing other read-only short queries to lock) has never occurred (including Postgres, Oracle, DB2, SQL Server, etc.) I can't believe other MySQL users don't use GROUP BY and I assume we must be missing something really dumb.

Please enlighten us if you can. Is there a way to get rid of the temp table which causes this performance problem without completely rewriting our app?

Feb 2 '08 #1
0 1327

Sign in to post your reply or Sign up for a free account.

Similar topics

by: Ed Wong | last post by:
I am looking for some published paper regarding database performance tunning performance strategies. This is for academic purpose so it needs not to be any commerical database specific. It will be even better if the paper has some kind of methods to quantify/measure performance. Has anyone come across with any interesting paper about this?...
by: Dick Zeeman | last post by:
Hi, I have a problem regarding the perfomance of a stp in combination with character translation. The following happens. We have an automated installation script (nt command file) for creating all stored procedures in a database. At first we used osql in this script, but with osql the international
by: Gaurav | last post by:
http://www.sys-con.com/story/print.cfm?storyid=45250 Any comments? Thanks Gaurav
by: jaggee | last post by:
Hello, This is regarding log analysis of a web system, I am finding my backend SQL programming has taken so much of time to process the application due to following quires for a log table having 500 million records, i have already done index tuning , but no use, so I would like to change the following quires into a single stored procedure in...
by: Ashish | last post by:
hi all, Iam trying to investigate some serious memory problems and ways to optimize them in our web application. some of the information i collected using the performance monitor, is that number of assemblies loaded per appdomain is large, we have a lot of pages which are using number of user controls, some of the documentation i read in...
by: Peter Ritchie | last post by:
I'm writing a Web Service and I would like to add performance counter data for monitoring performance of the Web Service's operations over time and load. The problem is, I get the "Requested registry access is not allowed." SecurityException when I try and create the performance counter category via PerformanceCounterCategory.Create(). I...
by: sp | last post by:
Hello I have a problem with the refresh performance in datagrid – when datagrid is being shown it is so slow that I can see one by one cells is drawn -datagrid contains about 35x40 of cells - they are generated through the odswierz_frekfencje() function (listed below)-
by: NAdir | last post by:
Hi, thank you for your help. My VB.Net application contains a document that the user can refresh at any time. The refresh works fine and needs to loop through few datatables (hundreds of rows). This works fine until I delete some rows in two tables. Just after the delete if I do the refresh there is a huge memory allocated and the time...
by: ianwr | last post by:
Hi, I wondered in anyone can help with the following problem that i'm experiencing, i'll try to provide as much info as possible and any suggestions would be appreciated. I have just started at an organsiation and there seems to be slow performance maybe on the san on a 64bit itanium dual core machine. 4 CPUs are being showed to sql...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.