0

I have table customer_Settings which has column key ,value,id,customer_id

$table->integer('id);
$table->integer('customer_id');
$table->string('key');
$table->string('value`);

Here is my query which i am using to get data

$customer_setting = CustomerSetting::select('customer_id','key','value')->where('customer_id', $customer_id)->where("key", $key)->get();

My question is which type of indexing we should do on customer_settings table. full_text?

if yes we want to use whereIn on key column . I mean to say i will give an array of keys query needs to get data according to that

Any suggestions please

Bilal Arshad
  • 531
  • 3
  • 11
  • 33
  • You can use `whereIn` without the `key` column being indexed. Also indexing is done on a single column, not a table. I'm unsure why indexing is being asked about in this context. – Will Walsh May 07 '21 at 03:14
  • i know i can use whereIn without indexing but i want to index key column. i want to know which type of indexing i should use on string type column. BTREE or FULLTEXT – Bilal Arshad May 07 '21 at 03:20
  • If it is a key like `Ak2DtepDbVC` and `BcD2ldpWBNk`, I would recommend `BTREE`, look about the differences on youtube. – matiaslauriti May 07 '21 at 03:28
  • BTREE and FULLTEXT are very different. FULLTEXT is actually much more than just an index. If you need to search for text WITHIN the value of a column, you will need to use FULLTEXT, otherwise BTREE would be fine. – Will Walsh May 07 '21 at 03:29
  • This should help you decide. https://stackoverflow.com/questions/707874/differences-between-index-primary-unique-fulltext-in-mysql – Will Walsh May 07 '21 at 03:30

0 Answers0