Add indexes for system file table#3
Open
Kulbij wants to merge 1 commit into
Open
Conversation
Contributor
|
Hi @Kulbij Thanks for this. Can you confirm that the following schema has the necessary indexes for performance? If not, could you please modify it based on your findings? Schema::create('system_files', function (Blueprint $table) {
$table->increments('id');
$table->string('disk_name');
$table->string('file_name');
$table->integer('file_size');
$table->string('content_type');
$table->string('title')->nullable();
$table->text('description')->nullable();
$table->string('field')->nullable();
$table->integer('attachment_id')->nullable();
$table->string('attachment_type')->nullable();
$table->boolean('is_public')->default(true);
$table->integer('sort_order')->nullable();
$table->timestamps();
$table->index(['attachment_type', 'attachment_id', 'field'], 'system_files_master_index');
});You can paste it as a comment here, if you like. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Work has been done to add indexes for the
system_filestable.As a result, we get an increase in the speed of queries to the
system_fielstable.Testing was carried out on high-load projects with a large number of images > 1 million for different models (for example: Products, Articles, etc.).
After adding indexes for the
system_filestable, the speed of the project (queries to the database) increased several times.