jeudi 22 novembre 2018

Laravel scoreboard of more than 1 million users

I'm working in a biggest application ( more than 1 million users ) and I try to get the ranking of each user in the scoreboard section but had this problem: the result is very very slow

This is the architecture of my database:

Schema::create('users', function (Blueprint $table) {
            $table->increments('id');
            ...
});


Schema::create('topics', function (Blueprint $table) {
            $table->increments('id');
            ...
});

The topics table have than 20 row


    Schema::create('user_scores', function (Blueprint $table) {
        $table->increments('id');
        $table->integer('user_id')->unsigned();
        $table->integer('topic_id')->unsigned();

        $table->unique(['user_id', 'topic_id']);

        $table->float('timer');
        $table->integer('score');
     });

Any optimization should I make the get the result quicker? Thanks.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire