SQL Performance (MOSC)

MOSC Banner

OLTP Aggregate queries best practices

edited Sep 20, 2020 8:28PM in SQL Performance (MOSC) 8 commentsAnswered

For instance, an OLTP mail application with an 800 million row table they developer want to count stuff like the number of unread emails.  What I’m finding is that when the count is high(200k) the queries are slow.   Should I create an index using the CREATE_DATE?  Or is there some other option I’m not thinking about.

So the query might be something like this. 

select  count(MAIL_ID)

  from EMAILS

  where

  USER_ID= :1

  DELETED = 0

  FOLDER_TYPE_ID = -4

        and CREATED_DATE > '09-18-2019' ;

select  count(a.MESSAGE_ID)

        from    EMAILS s

        inner join MESSAGE m

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center