CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM (Moderator: Dave Greenberg) »
  • Useless queries clogging up mysql
Pages: [1]

Author Topic: Useless queries clogging up mysql  (Read 1742 times)

mcarbone

  • Guest
Useless queries clogging up mysql
July 27, 2007, 10:56:29 am
Hey all,

I have a site with a large number of contacts (~200,000) currently undergoing heavy load.  I've been eying mytop, and along with normal-looking (if complex) queries pulling user info from the civicrm db, certain useless queries have been popping up, locking up mysql until I kill them.  I've seen two forms of these queries:

SELECT * FROM civicrm_address

and

SELECT * FROM civicrm_location

No WHERE clause, and no ORDER BY clause.  I have no idea where these queries are coming from, but they are slow with such a large db, and killing them clears things up temporarily.  Does anyone have an idea 1) where these might be coming from? or 2) a good way to trace their origin?  The query builder makes grep'ing for this kind of thing impossible.

FYI, this is running the latest stable release of 1.7 (PHP4) and Drupal 5.2.

Thanks!
-marco

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Useless queries clogging up mysql
July 27, 2007, 12:01:33 pm

Marco:

Do you know what CiviCRM operation triggers the below queries. Agreed, the below queries will kill a system, and i'd like to fix it for the 1.8 release.

Can u also post an issue for this.

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

mcarbone

  • Guest
Re: Useless queries clogging up mysql
July 27, 2007, 04:50:08 pm
Issue filed: http://issues.civicrm.org/jira/browse/CRM-2137

Summary: Lobo and I talked about this on IRC, which led me to adding some code to the _query function that looked for one of the bad queries, and sent a backtrace email to me when it happened (by calling the main function in dalin's very useful civicrm_error module for Drupal). 

After some problems with matching the query string (watching out for extra spaces and doing a substring match), I finally got a backtrace of the bad queries: they are being called via the isLocationEmpty function when a new contact is created.  See the issue for more details.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Useless queries clogging up mysql
July 28, 2007, 12:48:40 am

patch for this at: http://fisheye.civicrm.org/changelog/CiviCRM/?cs=10612

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM (Moderator: Dave Greenberg) »
  • Useless queries clogging up mysql

This forum was archived on 2017-11-26.