Which index is used ? ORACLE DB SQL -


select * sometable  column1='somevalue' , column2='someothervalue' 

for above query if both column1 , column2 have index tables ix1 , ix2, index used above example? assume 'somevalue' , 'someothervalue' existing values in table , column1 , column2 have non unique values.

also how differ if , replaced or?

the index used 1 oracle optimizer believes best query. "best" in case means selective -- is, single condition matches fewest rows (estimated based on statistics on table).

for query, best index either sometable(column1, column2) or somtable(column2, column1). equality conditions, either matches where clause.

with or situation tricker. think oracle can use both indexes query (check explain plan), more union/union all:

select * sometable column1 = 'somevalue' or selet * sometable column2 = 'someothervalue' , column1 > 'somevalue'; 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -