Jump to content

Question related to database performance.


techcone

Recommended Posts

Hello guys, may be my question is simple to you but for me its something I need to know :)

 

I have a big script. The main purpose of script is to scrap data and store in mysql.

 

Basically it can be structured like this :

 

# Database Connect

# Query

# Scrap

# Query

# Scrap

# Query

# Disconnect

 

What I want to know is what is best performance wise ? Opening a new connection for each query and closing after its completion ? Or open the connection once and let the script complete and then close it finally. Since scraping part will take considerable time may be 1-2 minutes.

 

Please reply that :)

I'd have to agree with cags - open, run your queries, then close. Is there no way to do

 

Query

Query

Query

Scrap

Scrap

Scrap

 

?

 

 

Thats the real problem the steps cant be serialize as you stated otherwise I would have done that :)

 

Oke I would open connection only when needed :)

 

Thanks :)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.