20

If I use $table->softDeletes() in a migration, a deleted_at timestamp nullable column is added to the table.

From now on I can come to the conclusion that any query against this table via eloquent will carry a WHERE deleted_at IS NULL clause, assuring only live records are returned.

But I noticed there is no index created for deleted_at. Shouldn't be paramount for this column to have an index?

I hope I'm missing something.

user2094178
  • 9,204
  • 10
  • 41
  • 70

1 Answers1

12

According to this answer, you should not index your deleted_at column. There will be no beneficial impact on performance.

Community
  • 1
  • 1
rap-2-h
  • 30,204
  • 37
  • 167
  • 263