Re: multiple databases

From: Date: Wed, 28 Feb 2001 10:53:39 +0000
Subject: Re: multiple databases
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-41987@lists.php.net to get a copy of this message
From: "Michael Hall" <lists@mulga.com.au> > > > Do you mean 10 different database servers, or 10 databases on the one > > server? > > 10 databases on the one server. > > > As far as I know, separate databases on the one server give the same > > performance as separate tables in one database. > > Music to my ears. Well, I'm pretty sure on that, but don't quote me ;-) If you think about it though, each table is just a set of files in a directory with the name of the database. It should not be any slower to access a table in one directory compared to a table in another directory (unless you split those directories onto separate physical disks or somesuch - but you could do the same thing using symlinks and one database). As for implementation in your script, you do not need to reconnect to access a different database; just do mysql_select_db("dbname") to switch between the databases. Or use mysql_db_query("dbname", "query"). However, there is probably no point in using 10 different databases - save yourself some complication and just use one. > > > With separate database servers you will run into new problems such as: > > -) can't combine data from servers, e.g. can't JOIN tables > > OK ... I didn't realise I could join tables across seperate databases. > Anywhere where joins are necessary, I'm using the one database. > > Thanks > > Mick > Indeed you can: 7.19 SELECT Syntax "You can refer to a column as col_name, tbl_name.col_name, or db_name.tbl_name.col_name." http://www.mysql.com/doc/S/E/SELECT.html Cheers Simon Garner

« previous php.general (#41987) next »