Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are good candidates for creating indexes on beside pk and unique columns?

I'm always asking myself should I create an index or not in my Oracle tables, what criteria in a table makes the index worth creating? And is it also a criteria in the query? And are there (with respect to Oracle) different kinds of indexes you can create based on some factor(s)?

like image 328
non sequitor Avatar asked Dec 08 '25 08:12

non sequitor


2 Answers

It's all about what queries are going to run against the table, how fast they're going to be, how fast you need them to be and how often they're going to be run. If you need to be able to find records quickly based on it, index it.

like image 146
chaos Avatar answered Dec 11 '25 11:12

chaos


Your queries.

You must look or better yet profile your client app code to see what fields are being used most often and /or have performance issues. If your app is not yet built, think about how the data is going to be used. For instance; If it is a table that will be used heavily for reports, and you have a datetime field, you most likely need an index (compound or not) on that field.

like image 41
Byron Whitlock Avatar answered Dec 11 '25 13:12

Byron Whitlock



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!