An index is a database object used for doing fast lookups on particular pieces of data. i.e.

select column1,colum2 from table1 where column1 = 'bob'

would be slow if there were a million records. But, if there was a structure that was faster to do a lookup on, an index, existed for this table, lookups would be faster. Indexes are seperate from tables as they are optimized for specific pieces of data. To use an index that you create, look up your db manual, just use it in the where clause somehow.

select col1,col2 from table1,table2 where table1.col1='bob' and table2.col2=table1.col2
This would join fast if there was an index on col2, and would also be fast on finding 'bob' if there was an index on col1.

Further more, indexes don't work well when you transform data. Doing ...

select * from table where col1*2 = 50
would never use an index, as you are comparing 50 to mutated data. If you did co1=50, it would be fine. There's an index on the values of the table, not the values that you mutate like above.


In reply to Re: Re: Searching and sorting a large DBF file by exussum0
in thread Searching and sorting a large DBF file by tyndyll

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.