homepage Welcome to WebmasterWorld Guest from 54.198.8.124
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
1 db or 2 in mySql with PHP
jetsetter




msg:1249912
 12:28 am on May 21, 2001 (gmt 0)

With PHP, is a script accessing 2 databases on the same account more intensive then using just one database.

Example, the first database has news articles, the second forums, and the third a user database. These are all relating to the same site.

Is there any benefit putting them all in one db, aside from organzational issues?

Do you have to connect twice to the db, or once? Server implications?

Thanks, Joseph

 

toolman




msg:1249913
 12:37 am on May 21, 2001 (gmt 0)

Hi jetsetter.

Thats a nice nuke site you got there. I can't answer the specifics about the connections to the bases other than to note that if you're running the news out of one and the forums out of the other than the user will always be requesting from one or the other....e.g they won't be fetching news from the forum page and they won't be fetchingforum threads from the news pages. So you will be accessing one database or the other at any one time. I'm thinking there shouldn't be any noticable differences in base connection times.

The upcoming release of Nuke 5.0 has addressed the multiple database problem and now prefaces all the tables with nuke_**** so you can run simultaneous programs from one base.

jetsetter




msg:1249914
 2:24 am on May 21, 2001 (gmt 0)

Hi, thanks for the kind words.

I'm actually asking a general question about the way mysql works.

I can code a page to pull data from 2 or more different databases using the mysql_select_db() command.

I'm just wondering if that means I'm opening one or multiple mysql sessions?

Joe

sugarkane




msg:1249915
 8:56 am on May 21, 2001 (gmt 0)

You would only be opening one session.

Once you open a connection using mysql_connect(), that connection stays alive until you either close it or the script finishes. You can then use mysql_select_db() as you say to choose which DB to access over the connection you've opened.

This is a good point you've brought up Joe, as it makes sense to avoid (when you can) the processing overhead that connection / disconnection involves.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved