<?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: Fields Orders in Select .. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/fields-orders-in-select/m-p/1895666#M374347</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In your specific case where primary-key fields are not in the where-clause, and index-fields are available, i feel it would not matter what the order of the fields is. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The SAP runtime environment will optimize this anyway, and choose the best available index based on your where-clause fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the reason why, for a table of fields F1, F2, F3, F4, where F1 and F2 are the primary key, and F3 and F4 are a secondary index, and your where-clause has F3, F4 and then F1, the primary-key will still get used. &lt;/P&gt;&lt;P&gt;In a case where F3 has an index and F4 also has an index, then if your where clause has F3 and F4, neither of the indexes will get used, due to ambiguity while trying to resolve indexes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A more useful recommendation would be to order the fields in the correct sequence in the select-clause, ie., the fields being fetched should be in the correct order.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 26 Jan 2007 17:34:52 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-01-26T17:34:52Z</dc:date>
    <item>
      <title>Fields Orders in Select ..</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fields-orders-in-select/m-p/1895665#M374346</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;Can somebody helpme in this doubt. I know is good to put the fields in the WHERE clausule at same order that fields appears in the table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But, i want to confirm, this not applies if there is an Index with other fields sequence ? i mean if in the table FieldX is first than FieldY (these are not in the primary Key) , but there is an index wich has first FieldY than Fieldx; then i must to use in clausule WHERE the same field sequence that the Index (FieldY, FieldX).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Frank&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jan 2007 17:27:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fields-orders-in-select/m-p/1895665#M374346</guid>
      <dc:creator>former_member425121</dc:creator>
      <dc:date>2007-01-26T17:27:12Z</dc:date>
    </item>
    <item>
      <title>Re: Fields Orders in Select ..</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fields-orders-in-select/m-p/1895666#M374347</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In your specific case where primary-key fields are not in the where-clause, and index-fields are available, i feel it would not matter what the order of the fields is. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The SAP runtime environment will optimize this anyway, and choose the best available index based on your where-clause fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the reason why, for a table of fields F1, F2, F3, F4, where F1 and F2 are the primary key, and F3 and F4 are a secondary index, and your where-clause has F3, F4 and then F1, the primary-key will still get used. &lt;/P&gt;&lt;P&gt;In a case where F3 has an index and F4 also has an index, then if your where clause has F3 and F4, neither of the indexes will get used, due to ambiguity while trying to resolve indexes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A more useful recommendation would be to order the fields in the correct sequence in the select-clause, ie., the fields being fetched should be in the correct order.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jan 2007 17:34:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fields-orders-in-select/m-p/1895666#M374347</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-26T17:34:52Z</dc:date>
    </item>
    <item>
      <title>Re: Fields Orders in Select ..</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fields-orders-in-select/m-p/1895667#M374348</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I find it good to put fields in key field order (primary or secondary) to make the program more readable. It will also point out to you (or the next programmer to look at it) if you are missing a key field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jan 2007 18:04:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fields-orders-in-select/m-p/1895667#M374348</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-26T18:04:19Z</dc:date>
    </item>
    <item>
      <title>Re: Fields Orders in Select ..</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fields-orders-in-select/m-p/1895668#M374349</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Frank,&lt;/P&gt;&lt;P&gt;as Rob already told keeping a certain order will improve readability of source code. Which index is chosen at runtime is left to the optimizer of the DBMS.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;  Klaus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jan 2007 18:06:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fields-orders-in-select/m-p/1895668#M374349</guid>
      <dc:creator>former_member183804</dc:creator>
      <dc:date>2007-01-26T18:06:48Z</dc:date>
    </item>
    <item>
      <title>Re: Fields Orders in Select ..</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fields-orders-in-select/m-p/1895669#M374350</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Good point Klaus. What I meant was the key you are &amp;lt;i&amp;gt;trying&amp;lt;/i&amp;gt; to use. The EXPLAIN function of ST05 will show which key is actually used. And you may want to check that to make sure that the SELECT is working the way you expect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jan 2007 18:14:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fields-orders-in-select/m-p/1895669#M374350</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-26T18:14:26Z</dc:date>
    </item>
  </channel>
</rss>

