get log date from tables available in query with data instead of last table #18868
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
When Logging feature is enabled and CiviCRM have Millions of records for contact, membership, contribution , entity tag, custom fields etc..., so in log tables, each contact have thousand of change log entries.
When we visit contact
Change Log
tab and mouse over the update icon, civicrm will send log connection id to report to find out the difference.CiviCRM collect all tables having reference with civicrm_contact tables. In this list, last tables is civicrm_entity_tag
To to fetch the log date value, civicrm uses last table
civicrm_entity_tag
, but there are possibility that, change log may not exist for that contact using specific connection id, but to find out value, civicrm iterate entire table with out result.Then ultimately , either we get no log change or database error or server timeout.
Instead of checking last table values, we should get table from Query we prepared with all table using union
Before
log date were get from
civicrm_entity_tag
table onlyAfter
Now log date get from
civicrm_contact
first, if not found , then next table get used.