Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

shaungbhone's avatar

Eloquent Performance on Jetstream

Laravel Jetstream browser session already gives me low performance. How can I fix that?

Screenshot from 2023-12-18 11-09-47

0 likes
7 replies
Tray2's avatar

Very simple, don't use uuid or similar as the primary key, you should use an integer as your primary key, because indexing doesn't really work well on random strings.

shaungbhone's avatar

@Tray2 I did not do anything. It's just a default laravel jetstream browser session.

shaungbhone's avatar

@Tray2 default jetstream session database.

public function up(): void
{
    Schema::create('sessions', function (Blueprint $table) {
        $table->string('id')->primary();
        $table->foreignId('user_id')->nullable()->index();
        $table->string('ip_address', 45)->nullable();
        $table->text('user_agent')->nullable();
        $table->longText('payload');
        $table->integer('last_activity')->index();
    });
}
Snapey's avatar

@shaungbhone 15ms does seem slow locally but its more likely to be your Db than laravel imo

1 like

Please or to participate in this conversation.