Warning: Undefined array key 100900 in phar:///home/duptmor/public_html/prod.mcpressonline.com/forum/core/vb/vb.phar/library/content.php on line 3534

Warning: Trying to access array offset on value of type null in phar:///home/duptmor/public_html/prod.mcpressonline.com/forum/core/vb/vb.phar/library/content.php on line 3536

Warning: Trying to access array offset on value of type null in phar:///home/duptmor/public_html/prod.mcpressonline.com/forum/core/vb/vb.phar/user.php on line 704

Warning: Undefined array key "online" in phar:///home/duptmor/public_html/prod.mcpressonline.com/forum/core/vb/vb.phar/library/content.php on line 3548

Warning: Trying to access array offset on value of type bool in phar:///home/duptmor/public_html/prod.mcpressonline.com/forum/core/vb/vb.phar/library/user.php on line 635

Warning: Trying to access array offset on value of type bool in phar:///home/duptmor/public_html/prod.mcpressonline.com/forum/core/vb/vb.phar/library/user.php on line 635

Warning: Trying to access array offset on value of type bool in phar:///home/duptmor/public_html/prod.mcpressonline.com/forum/core/vb/vb.phar/library/user.php on line 635

Warning: Trying to access array offset on value of type bool in phar:///home/duptmor/public_html/prod.mcpressonline.com/forum/core/vb/vb.phar/library/user.php on line 635

Warning: Undefined array key "reputationimg" in /home/duptmor/public_html/prod.mcpressonline.com/forum/includes/vb5/template.php(404) : eval()'d code on line 72

Warning: Trying to access array offset on value of type null in /home/duptmor/public_html/prod.mcpressonline.com/forum/includes/vb5/template.php(404) : eval()'d code on line 72

Warning: Undefined array key "reputationimg" in /home/duptmor/public_html/prod.mcpressonline.com/forum/includes/vb5/template.php(404) : eval()'d code on line 77

Warning: Trying to access array offset on value of type null in /home/duptmor/public_html/prod.mcpressonline.com/forum/includes/vb5/template.php(404) : eval()'d code on line 77

Warning: Undefined array key "reputationimg" in /home/duptmor/public_html/prod.mcpressonline.com/forum/includes/vb5/template.php(404) : eval()'d code on line 72

Warning: Trying to access array offset on value of type null in /home/duptmor/public_html/prod.mcpressonline.com/forum/includes/vb5/template.php(404) : eval()'d code on line 72

Warning: Undefined array key "reputationimg" in /home/duptmor/public_html/prod.mcpressonline.com/forum/includes/vb5/template.php(404) : eval()'d code on line 77

Warning: Trying to access array offset on value of type null in /home/duptmor/public_html/prod.mcpressonline.com/forum/includes/vb5/template.php(404) : eval()'d code on line 77

Warning: Undefined array key "reputationimg" in /home/duptmor/public_html/prod.mcpressonline.com/forum/includes/vb5/template.php(404) : eval()'d code on line 72

Warning: Trying to access array offset on value of type null in /home/duptmor/public_html/prod.mcpressonline.com/forum/includes/vb5/template.php(404) : eval()'d code on line 72

Warning: Undefined array key "reputationimg" in /home/duptmor/public_html/prod.mcpressonline.com/forum/includes/vb5/template.php(404) : eval()'d code on line 77

Warning: Trying to access array offset on value of type null in /home/duptmor/public_html/prod.mcpressonline.com/forum/includes/vb5/template.php(404) : eval()'d code on line 77

Warning: Undefined array key "reputationimg" in /home/duptmor/public_html/prod.mcpressonline.com/forum/includes/vb5/template.php(404) : eval()'d code on line 72

Warning: Trying to access array offset on value of type null in /home/duptmor/public_html/prod.mcpressonline.com/forum/includes/vb5/template.php(404) : eval()'d code on line 72

Warning: Undefined array key "reputationimg" in /home/duptmor/public_html/prod.mcpressonline.com/forum/includes/vb5/template.php(404) : eval()'d code on line 77

Warning: Trying to access array offset on value of type null in /home/duptmor/public_html/prod.mcpressonline.com/forum/includes/vb5/template.php(404) : eval()'d code on line 77

Warning: Undefined array key "reputationimg" in /home/duptmor/public_html/prod.mcpressonline.com/forum/includes/vb5/template.php(404) : eval()'d code on line 72

Warning: Trying to access array offset on value of type null in /home/duptmor/public_html/prod.mcpressonline.com/forum/includes/vb5/template.php(404) : eval()'d code on line 72

Warning: Undefined array key "reputationimg" in /home/duptmor/public_html/prod.mcpressonline.com/forum/includes/vb5/template.php(404) : eval()'d code on line 77

Warning: Trying to access array offset on value of type null in /home/duptmor/public_html/prod.mcpressonline.com/forum/includes/vb5/template.php(404) : eval()'d code on line 77

Warning: Undefined array key "birthday_search" in phar:///home/duptmor/public_html/prod.mcpressonline.com/forum/core/vb/vb.phar/api/user.php on line 173

Warning: Undefined array key "joindate" in phar:///home/duptmor/public_html/prod.mcpressonline.com/forum/core/vb/vb.phar/api/user.php on line 190

Warning: Undefined array key "posts" in phar:///home/duptmor/public_html/prod.mcpressonline.com/forum/core/vb/vb.phar/api/user.php on line 191

Warning: Undefined array key "posts" in phar:///home/duptmor/public_html/prod.mcpressonline.com/forum/core/vb/vb.phar/api/user.php on line 197

Warning: Undefined array key "userid" in phar:///home/duptmor/public_html/prod.mcpressonline.com/forum/core/vb/vb.phar/api/user.php on line 6509

Warning: Undefined array key "userid" in phar:///home/duptmor/public_html/prod.mcpressonline.com/forum/core/vb/vb.phar/api/user.php on line 212

Warning: Undefined array key "privacy_options" in phar:///home/duptmor/public_html/prod.mcpressonline.com/forum/core/vb/vb.phar/api/user.php on line 251

Warning: Undefined array key "userid" in phar:///home/duptmor/public_html/prod.mcpressonline.com/forum/core/vb/vb.phar/library/user.php on line 4998

Warning: Undefined array key "userid" in phar:///home/duptmor/public_html/prod.mcpressonline.com/forum/core/vb/vb.phar/library/user.php on line 1585

Warning: Undefined array key "lastactivity" in phar:///home/duptmor/public_html/prod.mcpressonline.com/forum/core/vb/vb.phar/library/user.php on line 1601
SQL Index - MC Press Online Forums

Unconfigured Ad Widget

Collapse

Announcement

Collapse
No announcement yet.

SQL Index

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • SQL Index

    An EVI helps the SQL query engine quickly find records when you specify a WHERE clause such as: SELECT * FROM filename Where field1 between 'A' and 'I' ORDER BY field1 I think in your case, you want to use just "CREATE INDEX" instead. Chris

  • #2
    SQL Index

    As a side note, actually I don't prefer to use an INDEX. I prefer a logical file. Both SQL and RPG (and COBOL) can use a logical file. RPG can't use an INDEX. Chris

    Comment


    • #3
      SQL Index

      For some reason, I also thought that RPG couldn't use an SQL Index. The same question came up in another forum. I was incorrect. You can use an index in an RPG program. I just tried it using the code below. We're at V5R2.
      Code

      Comment


      • #4
        SQL Index

        RPG can't use an EVI. It can use an SQL view or index. To sumarize, I think Chris's answer was correct.

        Comment


        • #5
          SQL Index

          My understanding is that by creating an index, you can save a lot of time processing SQL statements because the key structure is already defined. Hence, if I enter the following statement: CREATE ENCODED VECTOR INDEX x_filename ON filename (field1 ASC) WITH 256 DISTINCT VALUES , and I know for a fact that there are far fewer than 256 distinct values in field1, I would expect this request to run pretty zippy over my million-record file: SELECT * FROM filename ORDER BY field1. Instead I get, "Query running. Building access path for file filename in libraryname." Can anyone point out the error in my process? Thanks, everyone.

          Comment


          • #6
            SQL Index

            This is not that straightforward an answer. The SQL engine will try and select the most appropriate index when using SQL and sometimes this is not obvious. I have had to add/change various indexes to get the engine to avoid unneccessary path building when querying some complex views. As far as logical versus index, there the samething as far as db2/400 - both flagged as LF's when created, at least they are when creating a view. I wouldn't expect any difference between the two.

            Comment

            Working...
            X