oracle - SQL tuning issue -


i have query:

select count(1) cnt file_load_params a.doc_type = (select b.doc_type                     file_load_header b                     b.indicator = 'xelfasi')  order a.line_no 

which explain plan is:

----------------------------------------------------------------------------------------------------- | id  | operation                     | name                | rows  | bytes | cost (%cpu)| time     | ----------------------------------------------------------------------------------------------------- |   0 | select statement              |                     |     1 |     7 |     3   (0)| 00:00:01 | |   1 |  sort aggregate               |                     |     1 |     7 |            |          | |*  2 |   table access full           | file_load_params    |    15 |   105 |     2   (0)| 00:00:01 | |   3 |    table access index rowid| file_load_header    |     1 |    12 |     1   (0)| 00:00:01 | |*  4 |     index unique scan         | file_load_header_uk |     1 |       |     0   (0)| 00:00:01 | ----------------------------------------------------------------------------------------------------- 

i thought optimize query , write one:

select count(1) cnt file_load_params a,file_load_header b  b.indicator = 'xelfasi' , a.doc_type = b.doc_type order a.line_no 

its explain plan is:

----------------------------------------------------------------------------------------------------- | id  | operation                     | name                | rows  | bytes | cost (%cpu)| time     | ----------------------------------------------------------------------------------------------------- |   0 | select statement              |                     |     1 |    19 |     3   (0)| 00:00:01 | |   1 |  sort aggregate               |                     |     1 |    19 |            |          | |   2 |   nested loops                |                     |    15 |   285 |     3   (0)| 00:00:01 | |   3 |    table access index rowid| file_load_header    |     1 |    12 |     1   (0)| 00:00:01 | |*  4 |     index unique scan         | file_load_header_uk |     1 |       |     0   (0)| 00:00:01 | |*  5 |    table access full          | file_load_params    |    15 |   105 |     2   (0)| 00:00:01 | ----------------------------------------------------------------------------------------------------- 

is good? think not,but expected better result...do have idea?

one of possible optimizations see explain plan

table access full           | file_load_params   

this seems indicate table file_load_params possibly not have index on doc_type

if case, can add index doc_type. if have indexes, can post table schema file_load_params


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -