Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Amazon MySQL AWS Cloud Database Query Performance

Status
Not open for further replies.

barnettjacob

IS-IT--Management
Aug 12, 2011
31
GB
Hi, I'm trying to perform a SELECT query on an Amazon hosted MySQL database.

My query looks like this:

SQL:
select

user_id,
max(created_at)

from marketing_events

where description = 'signed in'

group by user_id

The table in question is about 20m records of which about half fit the 'signed in' criteria and the output of the query would likely be about 350k rows. Both columns are indexed (if that makes a difference).

The problem is that performance is incredibly slow - its been running for over 15 minutes and has yet to resolve! Am I being unreasonable in expecting it to run quicker than this? My ultimate goal is to use this as part of a larger 'user' query that adds this column to extra user data but there's little chance of that working when this simple won't!

Any advice welcome.
Jacob
 
Is description indexed too? is there any reason you use a text field rather than a set or an integer to denote the status?
Both would be faster.

But no, 15 minutes does not sound good. Try copying the dataset to a local underpowered dev machine and running it. On 20mn records I'd expect a second or so (but have not modeled this myself). I don't use Amazon aws so cannot comment more pointedly.
 
Jpadie, appreciate the response.

Think the text field is the only one that serves my purpose but will look for an alternative but reassuring to hear that there is obviously something not right - my previous experience of in-house servers is closer to the 1 second you mention.

Thanks again.
Jacob
 
Assuming the text can be one of a given set of information (ie it is not free text), then a set/enum would be better wouldn't it?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top