Queries are locking database

Home Forums Calendar Products Events Calendar PRO Queries are locking database

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #967893
    brainpop
    Participant

    Here is a sample of a query that is locking our db. This is the standard month view.

    It has THREE inner joins. Is that normal?

    SELECT   wp_posts.* FROM wp_posts  INNER JOIN wp_postmeta ON ( wp_posts.ID = wp_postmeta.post_id )  INNER JOIN wp_postmeta AS mt1 ON ( wp_posts.ID = mt1.post_id )  INNER JOIN wp_postmeta AS mt2 ON ( wp_posts.ID = mt2.post_id )  INNER JOIN wp_postmeta AS mt3 ON ( wp_posts.ID = mt3.post_id ) WHERE 1=1  AND wp_posts.post_type = 'tribe_events' AND ((wp_posts.post_status = 'publish')) AND (
      wp_postmeta.meta_key = '_EventStartDate'
      AND
      (
        mt1.meta_key = '_EventStartDate'
        AND
        ( mt2.meta_key = '_EventStartDate' AND CAST(mt2.meta_value AS DATE) >= '2015-05-01 00:00:00' )
        AND
        ( mt3.meta_key = '_EventEndDate' AND CAST(mt3.meta_value AS DATE) <= '2015-05-31 24:00:00' )
      )
    ) GROUP BY wp_posts.ID ORDER BY wp_postmeta.meta_value ASC

    What can we do to optimize?

    #968202
    Nico
    Member

    Hi brainpop,

    Thanks for reaching out on this.

    Actually it’s normal to see some multiple JOINs in our product queries. I’m sorry there’s no work around for this right now 🙁

    I pinged the dev team about this and it’s something that will probably be refactored in the future (maybe adding a table), but I’m sorry to say that will not happen in the short-term. You are welcome to suggest this a feature for future releases at our UserVoice page, that way it can up-voted by the community.

    Sorry I can’t be of much help with this,
    Best,
    Nico

    #972597
    Nico
    Member

    Hey brainpop,

    Since there hasn’t been any activity on this thread for over 2 weeks I’m now closing it. Feel free to start a new thread if you have further issues.

    Thanks,
    Nico

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Queries are locking database’ is closed to new replies.