<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Order in where clause - SQL statement in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/order-in-where-clause-sql-statement/m-p/2639858#M607673</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;But it lists all the fields in the index, correct?&lt;/P&gt;&lt;P&gt;I would like to know which index fields are used in my query....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 09 Aug 2007 12:29:51 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-08-09T12:29:51Z</dc:date>
    <item>
      <title>Order in where clause - SQL statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/order-in-where-clause-sql-statement/m-p/2639848#M607663</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The order of the fields in Where clause in OpenSQL statements is important to get the right index?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select a b c from t1 &lt;/P&gt;&lt;P&gt;where  &lt;/P&gt;&lt;P&gt;d = p_d and &lt;/P&gt;&lt;P&gt;e = p_e&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select a b c from t1 &lt;/P&gt;&lt;P&gt;where  &lt;/P&gt;&lt;P&gt;e = p_e and&lt;/P&gt;&lt;P&gt;d = p_d &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Index:&lt;/P&gt;&lt;P&gt;columns e and d.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks !&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Aug 2007 19:33:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/order-in-where-clause-sql-statement/m-p/2639848#M607663</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-08T19:33:20Z</dc:date>
    </item>
    <item>
      <title>Re: Order in where clause - SQL statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/order-in-where-clause-sql-statement/m-p/2639849#M607664</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi SRM,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The indexes should appear in the column index is preferable in the WHERE condition of SELECT statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check this thread which is related you your query&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="3912048"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Friendly Note: &amp;lt;/b&amp;gt;Don't post duplicate threads&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Vinay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Aug 2007 19:36:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/order-in-where-clause-sql-statement/m-p/2639849#M607664</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-08T19:36:03Z</dc:date>
    </item>
    <item>
      <title>Re: Order in where clause - SQL statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/order-in-where-clause-sql-statement/m-p/2639850#M607665</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There's no need to post duplicate threads accross forums. Please close one.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think it's good programming practice to specify fields in the index order, but I don't know of any case where it actually has an impact on performance (in Oracle or DB2).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Aug 2007 19:37:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/order-in-where-clause-sql-statement/m-p/2639850#M607665</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-08T19:37:24Z</dc:date>
    </item>
    <item>
      <title>Re: Order in where clause - SQL statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/order-in-where-clause-sql-statement/m-p/2639851#M607666</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for repost!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I already close the other post (I got a timeout and confused if that one was opened).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ok, we have here two different answers:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob believes it don´t impact the performance. &lt;/P&gt;&lt;P&gt;The post Vinaykumar sent suggests it is necessary (http://www.thespot4sap.com/Articles/SAPABAPPerformanceTuning_StructureOfWhereClause.asp)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, my question is how can I know,  using SQL Trace, which columns of the index are being used (only the MANDT, or the MANDT and the second, or the MANDT, sedond and third column)?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Aug 2007 20:06:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/order-in-where-clause-sql-statement/m-p/2639851#M607666</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-08T20:06:29Z</dc:date>
    </item>
    <item>
      <title>Re: Order in where clause - SQL statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/order-in-where-clause-sql-statement/m-p/2639852#M607667</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To check if an Index is Used do as follow:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1 - Open a second session and choose System -&amp;gt; Utilities -&amp;gt; Performance trace.&lt;/P&gt;&lt;P&gt;The Trace Requests screen appears.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2 - Select Trace on. &lt;/P&gt;&lt;P&gt;The SQL trace is activated for your user, that is all the database operations under your user are recorded.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3 - In the first window, perform the action in which the index should be used. &lt;/P&gt;&lt;P&gt;If your database system uses a cost-based optimizer, you should perform this action with as representative data as possible. A cost-based optimizer tries to determine the best index based on the statistics.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4 - In the second session, choose Trace off and then Trace list.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Result&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The format of the generated output depends on the database system used. You can determine the index that the database used for your action with the EXPLAIN function for the critical statements (PREPARE, OPEN, REPOPEN).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Marcelo Ramos&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Aug 2007 20:39:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/order-in-where-clause-sql-statement/m-p/2639852#M607667</guid>
      <dc:creator>marcelo_ramos1</dc:creator>
      <dc:date>2007-08-08T20:39:08Z</dc:date>
    </item>
    <item>
      <title>Re: Order in where clause - SQL statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/order-in-where-clause-sql-statement/m-p/2639853#M607668</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;But how can I know which columns are being used in the index???&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Aug 2007 20:40:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/order-in-where-clause-sql-statement/m-p/2639853#M607668</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-08T20:40:52Z</dc:date>
    </item>
    <item>
      <title>Re: Order in where clause - SQL statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/order-in-where-clause-sql-statement/m-p/2639854#M607669</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use the explain function of the SQL trace with both SELECTs. I'm betting that it will show exactly the same cost for each.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The EXPLAIN will show you which index is used.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(This is why you should only have one post open. I saw the other post but missed your question here.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Rob Burbank&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Aug 2007 20:44:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/order-in-where-clause-sql-statement/m-p/2639854#M607669</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-08T20:44:00Z</dc:date>
    </item>
    <item>
      <title>Re: Order in where clause - SQL statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/order-in-where-clause-sql-statement/m-p/2639855#M607670</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;On the SQL Trace list click on table name that you want to know index fields and then click on DDIC Info button(or press F6).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;On the next screen you have a list of &amp;lt;b&amp;gt;Indices of &amp;lt;table&amp;gt;&amp;lt;/b&amp;gt;, if the selection is using an index it'll be marked with "X" on Column Unique. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If your selection doesn't uses index the line &amp;lt;b&amp;gt;primary key&amp;lt;/b&amp;gt; will be marked in Column Unique.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Click on index or primary key and then you'll see the fields that you want.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Don't forget to close this Thread.&lt;/P&gt;&lt;P&gt;Best Regards.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Marcelo Ramos&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Aug 2007 21:07:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/order-in-where-clause-sql-statement/m-p/2639855#M607670</guid>
      <dc:creator>marcelo_ramos1</dc:creator>
      <dc:date>2007-08-08T21:07:03Z</dc:date>
    </item>
    <item>
      <title>Re: Order in where clause - SQL statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/order-in-where-clause-sql-statement/m-p/2639856#M607671</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The order is not mandatory but recommended to follow the other of the index, there is another thread (not yours) on the same topic.&lt;/P&gt;&lt;P&gt;&amp;gt; This should be obvious otherwise new indexs would oonyl influence new coding, &lt;/P&gt;&lt;P&gt;whcih is not true. That fact has positive and negative impacts.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The explain of the SQL trace shows you which index is used (all database platforms), some even tell you how many fields are used. Usually you can judge by yourself, how many fields of an index can be used. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Siegfried&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Aug 2007 07:01:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/order-in-where-clause-sql-statement/m-p/2639856#M607671</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-09T07:01:41Z</dc:date>
    </item>
    <item>
      <title>Re: Order in where clause - SQL statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/order-in-where-clause-sql-statement/m-p/2639857#M607672</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;/P&gt;&lt;P&gt;you can use any one&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Aug 2007 07:41:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/order-in-where-clause-sql-statement/m-p/2639857#M607672</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-09T07:41:10Z</dc:date>
    </item>
    <item>
      <title>Re: Order in where clause - SQL statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/order-in-where-clause-sql-statement/m-p/2639858#M607673</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;But it lists all the fields in the index, correct?&lt;/P&gt;&lt;P&gt;I would like to know which index fields are used in my query....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Aug 2007 12:29:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/order-in-where-clause-sql-statement/m-p/2639858#M607673</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-09T12:29:51Z</dc:date>
    </item>
    <item>
      <title>Re: Order in where clause - SQL statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/order-in-where-clause-sql-statement/m-p/2639859#M607674</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It should use the leftmost fields that you have specified in the where. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example if the index that a WHERE uses contains (in order) fields d, a, b, g and r and your WHERE contains d, a and r. The optimizer will attempt to use fields d an a only.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, it also depends on the selectivity of the fields in the index. If field d is say a company code and you have one large company code and a few smaller ones, specifying the large company code won't give as good performance as specifying a smaller one. It &amp;lt;i&amp;gt;will&amp;lt;/i&amp;gt; help, particularly since you are also specifying field a.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If field a is say a date and you specify a large date range, that also will not be as selective as specifying a smaller date range.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope all of this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Aug 2007 13:20:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/order-in-where-clause-sql-statement/m-p/2639859#M607674</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-09T13:20:23Z</dc:date>
    </item>
    <item>
      <title>Re: Order in where clause - SQL statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/order-in-where-clause-sql-statement/m-p/2639860#M607675</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Rob. &lt;/P&gt;&lt;P&gt;I understand the optimizer would use the leftmost fields that I have specified.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My question is: In SQL Trace or anywhere do I have this information listed (so that I don´t have to check the code) ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Aug 2007 13:33:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/order-in-where-clause-sql-statement/m-p/2639860#M607675</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-09T13:33:46Z</dc:date>
    </item>
    <item>
      <title>Re: Order in where clause - SQL statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/order-in-where-clause-sql-statement/m-p/2639861#M607676</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not that I know of, but we're programmers here. We check code for a living.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Aug 2007 14:13:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/order-in-where-clause-sql-statement/m-p/2639861#M607676</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-09T14:13:00Z</dc:date>
    </item>
    <item>
      <title>Re: Order in where clause - SQL statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/order-in-where-clause-sql-statement/m-p/2639862#M607677</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My conclusion:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The order in Where clause is not important.&lt;/P&gt;&lt;P&gt;There is no way to check which columns of the index are really used.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Aug 2007 19:57:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/order-in-where-clause-sql-statement/m-p/2639862#M607677</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-09T19:57:57Z</dc:date>
    </item>
    <item>
      <title>Re: Order in where clause - SQL statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/order-in-where-clause-sql-statement/m-p/2639863#M607678</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Aug 2007 19:58:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/order-in-where-clause-sql-statement/m-p/2639863#M607678</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-09T19:58:06Z</dc:date>
    </item>
    <item>
      <title>Re: Order in where clause - SQL statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/order-in-where-clause-sql-statement/m-p/2639864#M607679</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; The explain of the SQL trace shows you which index is used (all database &lt;/P&gt;&lt;P&gt;&amp;gt; platforms), some even tell you how many fields are used. Usually you can &lt;/P&gt;&lt;P&gt;&amp;gt; judge by yourself, how many fields of an index can be used. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please read answers carefully, check your SQL trace explain, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Some databases tell you how many fields are used ! &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Others tell you enough to get it implicitly, check selectivity ( 1/ (number of differnt values of field), calculate complete slectivity =&amp;gt; how many rows are expected,&lt;/P&gt;&lt;P&gt;compare with number of rows expected by the database !&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Order of field is not really important, however simple statements should always follow the order in the index, because statement cache should not be filled with indentical statements.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Siegfried&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Aug 2007 08:21:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/order-in-where-clause-sql-statement/m-p/2639864#M607679</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-10T08:21:45Z</dc:date>
    </item>
    <item>
      <title>Re: Order in where clause - SQL statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/order-in-where-clause-sql-statement/m-p/2639865#M607680</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; If field a is say a date and you specify a large date range, that also will not be &lt;/P&gt;&lt;P&gt;&amp;gt; as selective as specifying a smaller date range.&lt;/P&gt;&lt;P&gt;This is a confusing comment, the database decision which index should be taken, does NOT use the values of the field, i.e. it does not exploit the fact that interval are large or small!&lt;/P&gt;&lt;P&gt;=&amp;gt; all intervals get the selectivity&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Only in the processing the difference turns out!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Siegfried&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Aug 2007 08:25:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/order-in-where-clause-sql-statement/m-p/2639865#M607680</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-10T08:25:19Z</dc:date>
    </item>
  </channel>
</rss>

