Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6004493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:16:15+00:00 2026-05-23T01:16:15+00:00

I am trying to return a result set from a MySQL database table of

  • 0

I am trying to return a result set from a MySQL database table of email subscriptions.

The table is called subscribe and looks like this:

    +-----------------+------------------+------+-----+---------------------+-------+
    | Field           | Type             | Null | Key | Default             | Extra |
    +-----------------+------------------+------+-----+---------------------+-------+
    | eid             | int(11) unsigned | NO   | PRI | NULL                |       |
    | subscribeStatus | varchar(4)       | NO   | PRI | NULL                |       |
    | transDate       | datetime         | NO   | PRI | 0000-00-00 00:00:00 |       |
    | senttoevDate    | datetime         | YES  |     | NULL                |       |
    +-----------------+------------------+------+-----+---------------------+-------+

The PK is (eid,subscribeStatus,transDate) and there are the following extra indexes:

idxEid on eid,
idxTDate on transDate

The table is an InnoDB table. It contains about 480K rows.

The version of MySQL is 5.1.39 x86_64 and I’m running Windows 7 64bit.

The table has a row inserted each time a user subscribes or unsubscribes from email. I want to know what the latest subscription status is for all users. The query I want to run is:

select 
  eid, transDate from subscribe s
where
  transDate = (select max(transDate) from subscribe si where si.eid = s.eid)

When I run this in MySQL Query Browser (and in TOAD for MySQL) it immediately returns about 98K rows (into the results grid), and then just hangs. I can see from MySQL Administrator GUI that the state is “Sending data”. I have left it for up to an hour and it hasn’t finished returning the results, or even moved on from the 98K.

I have adjusted the my.ini params for InnoDB to increase the innodb_buffer_pool_size to 3Gb (my machine has 4Gb) but I can see from Task Manager that mysqld is never using more than about 400K Mb.

I have created a MyISAM version of the table to see if that is any better, but it also hangs at around about the same number of rows returned.

Can anyone suggest why the query returns some rows but then “hangs”, and also what I can do to get around this and get the query to return as it should?

Many thanks in advance for any help you can offer!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T01:16:16+00:00Added an answer on May 23, 2026 at 1:16 am

    I have no idea why it would hang, but why don’t you try to avoid the subquery with something like

    select eid, max(transDate) from subscribe group by eid
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have faced difficulties trying to return a result combined with the set of
I am trying to return the result that I found in my query to
I'm trying to decode the result of the Python os.wait() function. This returns, according
im trying to return a string value from a method inside my script tag
I'm trying to return a dictionary from a function. I believe the function is
I'm trying to return a transparent GIF from an .aspx page for display within
I am trying to return an array Data Member from one smaller 2D Array
I am trying to return the physical file path of a database's mdf/ldf files.
I'm trying to return a record from LINQ2SQL as a JsonResult to update my
If i have a table that looks like num 1 2 3 4 5

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.