What potential performance bottlenecks can you observe? How would you avoid them?


  • select

        extract(hour from loan_time), count(*), sum(cents_loaned/100),

        sum(count(*)) over (order by extract(hour from loan_time)),

        sum(sum(cents_loaned/100)) over (order by extract(hour from loan_time)),

        min(loan_time), max(loan_time)

      from tbl_loans

        where loan_time::date = '2012-10-01'

          group by extract(hour from loan_time)

          order by extract(hour from loan_time)

    Saturday, December 07, 2013 10:16 AM


  • Hello,

    Without table design and may existing indexes no one could tell you. E.g. is there an index for column "loan_time"?

    An please note: This is a forum for Microsoft SQL Server; the used syntax looks like MySQL, am I right?

    Olaf Helper

    [ Blog] [ Xing] [ MVP]

    Sunday, December 08, 2013 7:15 AM

All replies