[HyperDB] Using mysql replication

Andy Skelton skeltoac at gmail.com
Thu Aug 7 13:41:59 GMT 2008


On Thu, Aug 7, 2008 at 4:30 AM, Wouter Westendorp
<Wouter.Westendorp at ilsemedia.nl> wrote:
> However, the current implementation does a mysql_select_db / Init DB for
> each query @ r. 455-456.
>
> If we strip these checks from the if statement, everything still works
> as expected.
>
> Is there any reason to keep this in the code?

That logic was added because PHP reuses connections defined by
host+user+pass. If you have more than one database on a host, when you
reuse the connection without selecting the database you risk using the
wrong database (fixed in line 455). I also seem to remember times when
the connection was available to be reused but the database had become
unselected due to a timeout (456).

I know that these are not typical cases but they caused problems on
WordPress.com. Have you found the mysql_select_db statements to be a
big performance hit? How big?

Andy


More information about the HyperDB mailing list