DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: Index Usage

  1. #1
    Join Date
    Oct 2000
    Posts
    250

    Index Usage

    Hi All,
    I have a question on the SELECT Statement where it involve the group by clause.

    Example :
    SELECT A.something,B.someotherthing
    FROM table A, table B
    WHERE B.date <= :date
    GROUP BY A.something;

    In this case, is the SQL statement needs indexes for the A.something.
    After SQL selected out all the records which B.date <= :date into temporary space in memory, say may be 1 million records after that, does it means it will require perform full table scan in order to group the A.something ? or What is the best way to optimise the sql statement for the above scenario ?

    Thanks

  2. #2
    Join Date
    Jul 2003
    Location
    Sofia, Bulgaria
    Posts
    91
    If your table A is not with 1 row, you will have cartesian query (isn't there a join of A and B?).
    You can speed up the query with index on B.date (if you are selecting small % of all rows in B) and large SORT_AREA_SIZE for the group by.

  3. #3
    Join Date
    May 2000
    Location
    ATLANTA, GA, USA
    Posts
    3,135
    Where is the join condition between TableA and TableB?

    Tamil

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width