Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Best performance select condition

flvia_s
Participant
0 Likes
665

Hi guys.

I would like to listen your opinion on this performance issue.

I have a requirement to do a select on a Z table that has the primary key fields A, B and C.

The selection is based on the fields D, E, F, G and there exist an index for these four fields combined.

The data selection is this:

- field D = 01,

- field F is 'S',      if E = 001

          F is ''or 'E' if E = 002 or 003

- field G is in range_g

Now, what's the best selection for this? Would it be better to:

- use where condition with D = 01 and ( ( E = 001 and F = 'S') or ( E in (002, 003) and F in ('',E)) and G in range_g?

- use two separated selects?

Would really appreciate your opinion!

Best regards,

Alm.

3 REPLIES 3
Read only

matt
Active Contributor
0 Likes
612

Have you tried the different approaches and traced them through ST05? It's actually impossible for anyone to give a definitive answer as the performance depends very much on the data in the table.

Read only

0 Likes
612

Hi Matthew, the thing is that the table is new, so there is no data enough to test it...

Read only

matt
Active Contributor
0 Likes
612

Nonetheless. It's still impossible to give a definitive answer.

Write a program to put some data in it that's as realistic as possible. Then run ST05 sql trace on all the possibilities and see how the database optimiser handles it - which indexes are used and the performance.