SitePoint Sponsor

User Tag List

View Poll Results: In what order does MySQL "bore down"?

Voters
4. You may not vote on this poll
  • SELECT - WHERE - ORDER - LIMIT

    1 25.00%
  • SELECT - ORDER - WHERE - LIMIT

    0 0%
  • WHERE - ORDER - LIMIT - SELECT

    1 25.00%
  • ORDER - WHERE - LIMIT - SELECT

    0 0%
  • WHERE - ORDER - SELECT - LIMIT

    1 25.00%
  • something else, please specify

    1 25.00%
  • don't know / don't care as long as it works

    0 0%
Page 2 of 2 FirstFirst 12
Results 26 to 28 of 28
  1. #26
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,226
    Mentioned
    194 Post(s)
    Tagged
    2 Thread(s)
    Well, I am feeling very pleased about using
    PHP Code:
        SELECT ts_opts.option_name
             
    ts_opts.option_value
          FROM 
    SELECT option_name
                      
    option_value
                   FROM $wpdb
    ->options
                  WHERE autoload NOT LIKE 
    'yes'
                    
    AND option_name LIKE 'rss\_%\_ts'
            
    $no_query_less
               
    ) AS ts_opts
        UNION ALL
        SELECT non_ts_rss_opts
    .option_name
             
    NULL
          FROM 
    SELECT option_name
                   FROM $wpdb
    ->options
                  WHERE autoload NOT LIKE 
    'yes'
                    
    AND option_name LIKE 'rss\_%'
                    
    AND option_name NOT LIKE 'rss\_%\_ts'
            
    $no_query_less
               
    ) AS non_ts_rss_opts 
    Where $no_query_less is either empty or
    PHP Code:
    ORDER BY option_id DESC LIMIT " . ($query_limit / 2) 
    The experience has taught me more about how MySQL works and how to optimize a query to minimize resource use.

    Unfortunately the same plugin user is still having problems, this time a syntax error near FROM ( SELECT option_name , option_value
    He has MySQL 4 something so I need to find out if there are syntactial differences between different versions and/or engines.

    Another day, another puzzle.

  2. #27
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Subqueries weren't supported by MySQL until 4.1

  3. #28
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,226
    Mentioned
    194 Post(s)
    Tagged
    2 Thread(s)
    Ah, that would explain it. Thanks for the info. I did a bit of poking around the MySQL docs last night but didn't find that.

    (As I go off to find a way to add more fail-safe robustness)


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •