We came across and issue where we were using Microsoft Dynamics AX 4.0 SP2 ( and also applies to AX 2009) where opening the AIF Document history form ((Basic -> Periodic -> AIF -> Document history) takes a long time and often it will appear as though the AX client has hung. This is generally experienced if you have a significant amount of large messages that have been logged or have several hundred rows in the history table.
The reason for the delay is that the AIFDOCUMENTHISTORY form contains a data source to the AifDocumentLog table, and it will read the xml messages stored in the table. This can take a significant time if you have very large messages stored or have several hundred rows in the table. The reason for having the AifDocumentLog data source was to determine if any document log entries exist for a particular message, and then use this to disable/enable the Document logs button.
To workaround the issue, you can remove AifDocumentLog data source from the AIFDOCUMENTHISTORY form. The logs are still accessible via the document logs button on the form.