1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

WordPress database queries

Discussion in 'Programming' started by Mubashir Ahmad, Mar 21, 2017.

  1. #1
    It usually requires large queries to get the desired data from WordPress database. Times it requires lot of joins as multiple tables are used. Is there any hack to get the data from wordpess database while avoiding long queries.
     
    Mubashir Ahmad, Mar 21, 2017 IP
  2. arcneon

    arcneon Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #2
    You could create views to encapsulate the long/complicated queries; for syntax and examples check this: https://dev.mysql.com/doc/refman/5.7/en/create-view.html.
     
    arcneon, Mar 23, 2017 IP
  3. sarahk

    sarahk iTamer Staff

    Messages:
    28,500
    Likes Received:
    4,460
    Best Answers:
    123
    Trophy Points:
    665
    #3
    Have you got a wordpress site with so much content that it matters?

    Joins etc just mean the design is right and are nothing to be afraid of.

    Can you give us an example of a query that is slowing your site down?
     
    sarahk, Mar 23, 2017 IP
  4. cLogik

    cLogik Active Member

    Messages:
    159
    Likes Received:
    28
    Best Answers:
    0
    Trophy Points:
    90
    #4
    Cache and or PHP Acceleration is mandatory with any Wordpress installation.
     
    cLogik, Mar 28, 2017 IP
  5. Mubashir Ahmad

    Mubashir Ahmad Greenhorn

    Messages:
    18
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    13
    #5
    The query to find out the sales of specific brand in specif area required me to join 5 different tables. Is there any plugin or any means of doing this without writing long queries. I am using mysql DB.
     
    Mubashir Ahmad, Apr 4, 2017 IP
  6. sarahk

    sarahk iTamer Staff

    Messages:
    28,500
    Likes Received:
    4,460
    Best Answers:
    123
    Trophy Points:
    665
    #6
    Joining 5 tables is absolutely fine. A plugin is still going to do the join.
    If you give us the sql for the query we might be able to understand your concerns a bit better.
     
    sarahk, Apr 4, 2017 IP
  7. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #7
    If you need data that's scattered among 5 tables, you're going to have to SELECT on 5 tables, there's no other way. There may be some code that you can give the table and field names to, and it will return the data for you, but the part you write is still going to be almost as long. That's just the way SQL works. The only "plugin" that would shorten the query would be one that's already written for those tables and fields, and you just call it - but if you need queries on different sets of fields and/or tables, it's going to be shorter to write each one individually.
     
    Rukbat, Apr 9, 2017 IP