laravel / framework

The Laravel Framework.
https://laravel.com
MIT License
32.38k stars 10.98k forks source link

laravel mysql database sharding database sharding table #48496

Closed jasonccs closed 1 year ago

jasonccs commented 1 year ago

Laravel Version

10.23.1

PHP Version

8.2.3

Database Driver & Version

5.7

Description

We are currently looking solution/library for Sharding our DB with Laravel. Do you know the good one?

Steps To Reproduce

We are currently looking solution/library for Sharding our DB with Laravel. Do you know the good one?

jasonccs commented 1 year ago

Does Laravel have a plugin package with MySQL database ? My business data volume is very large, so I am considering dividing it into databases and tables to handle queries on large data, in order to improve efficiency

If I have 4 tables in the same MySQL database and the table structure is the same, as shown in Figure users01,users02,users03,users04,

public function up(): void
{
    Schema::create('users', function (Blueprint $table) {
        $table->id();
        $table->string('name');
        $table->string('email')->unique();
        $table->timestamp('email_verified_at')->nullable();
        $table->string('password');
        $table->rememberToken();
        $table->timestamps();
    });
}

Can I perform data sharding according to the specified fields, add, delete, modify, and query data, and perform related operations on the associated table,