It will be advisable to add an index to a database field for better performance and quick selection of records from the database table.
Use the below snippet to add an index to database field in Magento 2.
->addIndex( $installer->getIdxName('table_name', ['table_field1', 'table_field2']), ['table_field1', 'table_field2'] )
Leave a Reply