CPU and Memory Usage: Connect and disconnect

Discussion in 'MySQL' started by vdTOG, Feb 13, 2016.

  1. #1
    I'm having problems with consumption of the CPU and the memory.
    What of these options would help me to consume less?


    Option #1
    Connect to sql server, execute the sql command and disconnect once it is done. And do again for each command.

    Option #2
    Connect to sql server, execute all the sql commands and disconnect when script dies.


    More ideas will be very appreciated.

    Thank you
     
    vdTOG, Feb 13, 2016 IP
  2. billzo

    billzo Well-Known Member

    Messages:
    961
    Likes Received:
    278
    Best Answers:
    15
    Trophy Points:
    113
    #2
    I think the difference in memory consumption would be negligible. If you are doing multiple queries, I say you are best to leave the connection so as to not incur the connection overhead.
     
    billzo, Feb 14, 2016 IP
  3. vdTOG

    vdTOG Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #3
    I understand. I'll do it. Thank you
     
    vdTOG, Feb 15, 2016 IP