homepage Welcome to WebmasterWorld Guest from 54.227.41.242
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Databases
Forum Library, Charter, Moderator: open

Databases Forum

    
Multiple database connections
Is there a disadvantage using multiple database connections?
Wayder




msg:4220039
 10:58 pm on Oct 21, 2010 (gmt 0)

MySQL 4.1.25
PHP 5.2.13

I have a site that is geting quite large and needs reorganising.

Instead of using one database with multiple tables with prefixes such as user_, directory_, events_, tracking_ etc. I was thinking of using multiple databases and place all the tables required for that function into that database.

This would mean multiple connections:

$conn_users = mysql_connect('localhost',$user_users,$pass_users);
$conn_track = mysql_connect('localhost',$user_tracker,$pass_tracker,TRUE);
$conn_dir = mysql_connect('localhost',$user_directory,$pass_directory,TRUE);
$conn_events = mysql_connect('localhost',$user_events,$pass_events,TRUE);

mysql_select_db($db_users,$conn_users);
mysql_select_db($db_tracking,$conn_track);
mysql_select_db($db_directory,$conn_dir);
mysql_select_db($db_events,$conn_events);

I was just wondering if using multiple databases and connections this way will create performance or memory issues.

Comments/advice please.

 

enigma1




msg:4220249
 10:40 am on Oct 22, 2010 (gmt 0)

I would expect a performance hit with multiple databases. So right now with each page request, your server performs a single db connection. With multiple dbs each request will cause 4 connections based on what you said. That may cause greater latencies than what queries cause.

If you can simplify the db structure and optimize the queries its possible to avoid it.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Databases
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