To increase system load capacity, PHPCMS V9 introduces a table separation technique. However, many webmasters are unsure how to use it. Here is a brief guide to applying table separation in phpcms V9:
1. First, create a connection pool for another database by modifying caches/configs/database.php
The modified configuration is as follows (master adds a connection pool for another MYSQL server):
return array (
'default' => array (
'hostname' => 'localhost',
'database' => 'phpcms8',
'username' => 'root',
'password' => 'phpcms8',
'tablepre' => 'v9_',
'charset' => 'gbk',
'type' => 'mysql',
'debug' => true,
'pconnect' => 0,
'autoconnect' => 0
),
'master' => array (
'hostname' => '200.200.200.200',
'database' => 'master',
'username' => 'root',
'password' => '123456',
'tablepre' => 'v9_',
'charset' => 'gbk',
'type' => 'mysql',
'debug' => true,
'pconnect' => 0,
'autoconnect' => 0
),
);
?>
Next, go to the file inside phpcms/model/ named after the database table you want to place in the master connection pool, suffixed with _class.php. Open the file and locate the following:
$this->db_config = pc_base::load_config('database');
$this->db_setting = 'default';
$this->table_name = 'category_priv';
parent::__construct();
Change default to master, then update the cache. Generally, table separation is done by module or category. Try to avoid splitting tables within the