I've done it in 20 minutes (clearing immigration, retrieving bags, clearing customs and going between terminals -- which are adjoined in MEL so it is very easy). More realistically an hour is OK, so 2 hours is very comfortable, even if you are in the last row of Y. But MEL has a fine Qantas club, some would choose to delay their connection and spend an hour or two or three there (but the bar opens quite late on the domestic side). MEL is a great airport, much nicer than LAX for example.