MySQL...Find BAD Queries

Discussion in 'MySQL' started by alphacooler, Dec 18, 2006.

  1. #1
    I've been running into some server problems lately, and was advised to check a number of things. One of them being looking for BAD QUERIES.

    How does one go about looking for these?

    Thanks.
     
    alphacooler, Dec 18, 2006 IP
  2. tanfwc

    tanfwc Peon

    Messages:
    579
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Do a repair to your database first and see what's wrong with the table.
     
    tanfwc, Dec 18, 2006 IP
  3. krakjoe

    krakjoe Well-Known Member

    Messages:
    1,795
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    135
    #3
    Bad queries ???

    That seems a very strange thing to look for as queries aren't actually stored in the database at all......
     
    krakjoe, Dec 19, 2006 IP
  4. daboss

    daboss Guest

    Messages:
    2,249
    Likes Received:
    151
    Best Answers:
    0
    Trophy Points:
    0
    #4
    bad queries could mean sql statements that are not well designed and can cripple your database/server.

    for example, if you have a database table of 20,000,000 records and you perform a query: "select * from table", you will surely create serious crippling problems. in this case, you should always select only the fields that you are interested in (instead of a select *) and you should always put selection criteria (e.g. where field_1 = 20).

    the above is just one example... you need to relook all your sql commands to review if they will load your server too much. ;)
     
    daboss, Dec 19, 2006 IP