<?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: Substr Question??? in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/substr-question/m-p/3415271#M861576</link>
    <description>doh...just saw your followup...not sure if Sybase supports function-based indexes or not, but query #1 does indeed preclude the use of a standard index even in Sybase.</description>
    <pubDate>Thu, 04 Nov 2004 15:20:06 GMT</pubDate>
    <dc:creator>James A. Donovan</dc:creator>
    <dc:date>2004-11-04T15:20:06Z</dc:date>
    <item>
      <title>Substr Question???</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/substr-question/m-p/3415267#M861572</link>
      <description>Hi All&lt;BR /&gt;&lt;BR /&gt;Is there any explanation as to why the SQL1 statement (substr) takes longer than the SQL2 statement? &lt;BR /&gt;They are both index the same.&lt;BR /&gt;&lt;BR /&gt;SQL1&lt;BR /&gt;select count(*) from CE.CDR_DRMS &lt;BR /&gt;where substr(FE_F,9,8) &amp;gt;= '20041001' and substr(FE_F,9,8) &amp;lt;= '20041001'&lt;BR /&gt;     and STAT_CODE like 'r%';&lt;BR /&gt;&lt;BR /&gt;SQL2&lt;BR /&gt;select count(*) from CE.CDR_DRMS &lt;BR /&gt;where R_DT &amp;gt;= '20041001 00:00:00' and R_DT &amp;lt;= '20041001 23:59:59'&lt;BR /&gt;     and STAT_CODE like 'r%';&lt;BR /&gt;&lt;BR /&gt;Many Thanks&lt;BR /&gt;Chris&lt;BR /&gt;</description>
      <pubDate>Thu, 04 Nov 2004 14:16:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/substr-question/m-p/3415267#M861572</guid>
      <dc:creator>Chris Frangandonis</dc:creator>
      <dc:date>2004-11-04T14:16:13Z</dc:date>
    </item>
    <item>
      <title>Re: Substr Question???</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/substr-question/m-p/3415268#M861573</link>
      <description>&lt;BR /&gt;Go try EXPLAIN PLAN for you query.&lt;BR /&gt;&lt;BR /&gt;I'm sure you'll see that in the first case you 'decoupled' the target from the index and that oracle is either doing an fullindex scan or full tablescan versus 'index range scan' for the second case.&lt;BR /&gt;&lt;BR /&gt;The oracle optimizer is not going to look at the actual substr arguments and realize that the sorting order HAPPENS to match the index sort order. In the second case it knows.&lt;BR /&gt;&lt;BR /&gt;hth,&lt;BR /&gt;Hein.&lt;BR /&gt;</description>
      <pubDate>Thu, 04 Nov 2004 14:39:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/substr-question/m-p/3415268#M861573</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2004-11-04T14:39:17Z</dc:date>
    </item>
    <item>
      <title>Re: Substr Question???</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/substr-question/m-p/3415269#M861574</link>
      <description>Hi Hein&lt;BR /&gt;&lt;BR /&gt;Thanks for the input. I am using Sybase and not oracle as my D/B. To use SQL1 with substr it gives me a more accurate output to what I am requesting than SQL2. If I need to improve this how/what should my SQL look like?&lt;BR /&gt;&lt;BR /&gt;Thanks Again&lt;BR /&gt;Chris</description>
      <pubDate>Thu, 04 Nov 2004 15:16:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/substr-question/m-p/3415269#M861574</guid>
      <dc:creator>Chris Frangandonis</dc:creator>
      <dc:date>2004-11-04T15:16:00Z</dc:date>
    </item>
    <item>
      <title>Re: Substr Question???</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/substr-question/m-p/3415270#M861575</link>
      <description>By applying the substr function you immediately preclude the use of any standard index you may have on the FE_F column.  As a result, query #1 runs slower than you would think it should.&lt;BR /&gt;&lt;BR /&gt;If you have function-based index on FE_F then that index could be used to help query #1&lt;BR /&gt;&lt;BR /&gt;e.g.&lt;BR /&gt;&lt;BR /&gt;create index myindex on CE.CDR_DRMS(substr(FE_F,9,8))&lt;BR /&gt;&lt;BR /&gt;will create a function based (substr) index on the FE_F column of the CDR_DRMS table.&lt;BR /&gt;</description>
      <pubDate>Thu, 04 Nov 2004 15:18:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/substr-question/m-p/3415270#M861575</guid>
      <dc:creator>James A. Donovan</dc:creator>
      <dc:date>2004-11-04T15:18:12Z</dc:date>
    </item>
    <item>
      <title>Re: Substr Question???</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/substr-question/m-p/3415271#M861576</link>
      <description>doh...just saw your followup...not sure if Sybase supports function-based indexes or not, but query #1 does indeed preclude the use of a standard index even in Sybase.</description>
      <pubDate>Thu, 04 Nov 2004 15:20:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/substr-question/m-p/3415271#M861576</guid>
      <dc:creator>James A. Donovan</dc:creator>
      <dc:date>2004-11-04T15:20:06Z</dc:date>
    </item>
    <item>
      <title>Re: Substr Question???</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/substr-question/m-p/3415272#M861577</link>
      <description>Check if the following input from Net helps:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://sybooks.sybase.com/onlinebooks/group-asarc/srg1100e/sqlug" target="_blank"&gt;http://sybooks.sybase.com/onlinebooks/group-asarc/srg1100e/sqlug&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;substring &lt;BR /&gt; (expression, start, length)&lt;BR /&gt; Returns part of a character or binary string. start specifies the character position at which the substring begins. length specifies the number of characters in the substring.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.sybase.com/detail?id=2602" target="_blank"&gt;http://www.sybase.com/detail?id=2602&lt;/A&gt;&lt;BR /&gt; &lt;BR /&gt;Pre-System 11 Syntax: forceindex &lt;BR /&gt;Place the indid of the index you wish to force in parentheses immediately following the table name in the from clause of the query: &lt;BR /&gt;&lt;BR /&gt;select colA,colB,colC&lt;BR /&gt;from table_name(indid)&lt;BR /&gt;where.....&lt;BR /&gt;&lt;BR /&gt;There are a couple of ways to get the indid for an index: &lt;BR /&gt;&lt;BR /&gt;To get the indid and name of all indexes on a table, run the following query: &lt;BR /&gt; &lt;BR /&gt;1&amp;gt; select indid,sysindexes.name&lt;BR /&gt;2&amp;gt; from sysindexes, sysobjects&lt;BR /&gt;3&amp;gt; where sysindexes.id=sysobjects.id&lt;BR /&gt;4&amp;gt; and sysobjects.name="table_name"&lt;BR /&gt;5&amp;gt; go&lt;BR /&gt;&lt;BR /&gt;To get the name of an index using its indid, run the following query: &lt;BR /&gt; &lt;BR /&gt;1&amp;gt; select indid,sysindexes.name&lt;BR /&gt;2&amp;gt; from sysindexes, sysobjects&lt;BR /&gt;3&amp;gt; where sysindexes.id=sysobjects.id&lt;BR /&gt;4&amp;gt; and sysobjects.name="table_name"&lt;BR /&gt;5&amp;gt; and sysindexes.indid=index_id&lt;BR /&gt;6&amp;gt; go&lt;BR /&gt;&lt;BR /&gt;System 11 Syntax: Specifying an Index &lt;BR /&gt;In System 11, forceindex is now fully supported. Functionally the same as in previous SQL Server versions, the new syntax allows the use of an index name rather than the index ID: &lt;BR /&gt;&lt;BR /&gt;select colA,colB,colC&lt;BR /&gt;from table_name (index index_name)&lt;BR /&gt;where.....&lt;BR /&gt;&lt;BR /&gt;sks</description>
      <pubDate>Mon, 08 Nov 2004 23:59:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/substr-question/m-p/3415272#M861577</guid>
      <dc:creator>Sanjay Kumar Suri</dc:creator>
      <dc:date>2004-11-08T23:59:25Z</dc:date>
    </item>
  </channel>
</rss>

