Problem with using UNION on big tables

Discussion in 'MySQL' started by deriklogov, Nov 28, 2009.

  1. #1
    Hello,


    I got problem when try to combine couple big tables with UNION, after running query it takes for ever and finish it. Phpmyadmin getting timeout.
    What you can suggest ?
     
    deriklogov, Nov 28, 2009 IP
  2. n3r0x

    n3r0x Well-Known Member

    Messages:
    257
    Likes Received:
    4
    Best Answers:
    1
    Trophy Points:
    120
    #2

    Explain more..
    How large are we talking?
    How many results are you fetching?
    Are you searching for a "String/varchar" or an "Int/long"?
    Are the thing you search for indexed?

    More information will make it easier for other people to help you.
     
    n3r0x, Nov 29, 2009 IP
  3. plog

    plog Peon

    Messages:
    298
    Likes Received:
    11
    Best Answers:
    1
    Trophy Points:
    0
    #3
    Normalize the data and don't run union queries.
     
    plog, Nov 30, 2009 IP
  4. iama_gamer

    iama_gamer Active Member

    Messages:
    404
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    60
    #4
    Can you give an example of the query your trying and the data structure? and how many rows? unions can be used if they are used in a proper way but they can take a long time if the structures arent optimised
     
    iama_gamer, Dec 3, 2009 IP