Results 1 to 2 of 2

Thread: Performance

  1. #1
    Join Date
    Feb 2005
    Location
    India
    Posts
    3

    Unanswered: Performance

    Hi Folks,

    There are two tables t1 with column c1 and t2 with column c2.
    Both the cloumn type are same and both tables have same number of rows.

    Consider this query.

    select avg(c1) from t1
    go

    select avg(c2) from t2
    go

    Can anyone tell me which query runs faster?
    What about other aggregate functions like max and min?

    Thnx
    Prajod

  2. #2
    Join Date
    Dec 2004
    Posts
    25
    both queries will run equally fast if we assume that other factors like network speed, load on server etc are the same.

    avg : this query will result in a table scan

    min/max : if there is no index on the table, it will result in a table scan. however if there is an unique index on the column, reading the start/end of the index should provide the result.

Posting Permissions

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