Automattic / Automattic/HyperDB
Slave Only Read from Tabel
- Dominant language
- PHP
- Stars
- 150
- Forks
- 28
- PR merge metrics
- No merged PRs in 30d
Description
Hello,
I want to use my slave server only for 2 tables. But can't find a suitable guide and this code doesn't seem to work, can anyone help?
Is it possible to also specifically exclude tables?
Ok I will use only Read Modus on **wpoa_posts** and **wpoa_postmeta** on a Mysql 8 Slave for more Performance, the table posts and postmeta are very big size.
thanks in advance
Manu
`$wpdb->add_database( array(
'host' => '127.0.0.1:3380',
'user' => 'blog_user',
'password' => 'pass',
'name' => 'sport',
'dataset' => 'testme',
'write' => 0,
'read' => 1,
) );
$wpdb->add_callback( 'my_db_callback' );
function my_db_callback( $query, $wpdb ) {
if ( preg_match("/wpoa_post%/", $wpdb->table) ) {
return 'testme';
}
}`
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.