• Post Reply Bookmark Topic Watch Topic
  • New Topic

help on selecting Index

 
Nakata kokuyo
Ranch Hand
Posts: 472
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
good day, everyone

if i have a transaction table with fields below :

transaction_no, product_id, product_desc, product_qty, product_txn, transaction_date

can some expert here point out to me , which is the best cluster-index and non-clsuter index ?

and possible kindly please explain why is it so? i'm not good in database so just explain like to beginner

thank you very much for guidance
 
stu derby
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To know the best index(es), you have to know the queries: both the queries themselves and at least a rough idea of their frequency and importance. Otherwise, it's like asking "what data type should I use for my new variable named Green".

In particular, columns that appear frequently in WHERE clauses are often good choices for indexes. However, each index takes space and also slows down every INSERT/UPDATE/DELETE by a tiny bit.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!