Answers.Body: <p>Why do you use a smart group for syncing with mailchimp? What would happen if someone unsubscribe from mailchimp? </p>
  
  <p>I would advise to use a normal group for a mail group, that way you are sure what would happen if someone unsubscribes (either via Mailchimp or via CiviCRM). </p>
  
  <p>If you need people to be automaticly subscribed to mailgroup you could use CiviRules (<a href="https://civicrm.org/extensions/civirules" rel="nofollow noreferrer">https://civicrm.org/extensions/civirules</a>) for that.
  Documentation on CiviRules could be found at: <a href="https://docs.civicrm.org/civirules/en/latest/" rel="nofollow noreferrer">https://docs.civicrm.org/civirules/en/latest/</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-28T12:57:32.350Z
Answers.Text: Hi Jaap, 
  
  It's because we group people dynamically based on certain data, usually membership contribution status and their geolocation.
  
  We do a one-way upload, so if the user unsubscribers from Mailchimp, then mailchimp handles their unsubscription.
  
  Civi rules may be a good solution, but I am still concerned about how civi is working. Is my installation broken if it can't maintain a list of smart group counts? This seems like a bug to me.
Answers.UserDisplayName: Joel
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-28T14:50:58.063Z
Answers.Text: The smart groups are a bit buggy and unstable in CiviCRM. Altough I am not a user and quite a few users use them succesfully. But I had some clients in the past where smart group counts did not work, or where the smart group caused a database deadlock. So my general advice is to stay away from smart groups.
Answers.UserDisplayName: Jaap Jansma - CiviCooP
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-24T07:54:48.870Z
Answers.LastActivityDate: 2018-05-24T07:54:48.870Z
Answers.UserDisplayName: Jaap Jansma - CiviCooP
Answers.Body: <p>This Q/A discussion "<a href="https://civicrm.stackexchange.com/questions/22384/should-manage-groups-display-the-smart-group-contact-count-or-just-display-it-a">Should Manage Groups display the Smart Group contact count, or just display it as Unknown</a>" may help including following the links to read the comments for issue <a href="https://issues.civicrm.org/jira/browse/CRM-21583" rel="nofollow noreferrer">CRM-21583</a>.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-28T13:20:55.297Z
Answers.Text: I see it should say "unknown" if no cache is found. However, I think this should never happen. The moment when the cache is not found, the mailchimp extension thinks I have no more users in the mailing list and it unsubscribed everyone.
  
  My Smart Group Timeout was set to 5 minutes and the scheduled jobs set to run every 15 minutes.
  
  Perhaps the smart group timeout needs to be longer than the scheduled job time? I have updated the cache timeout to 20 minutes to see what happens.
Answers.UserDisplayName: Joel
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-23T12:53:17.550Z
Answers.LastActivityDate: 2018-05-23T12:53:17.550Z
Answers.UserDisplayName: oskylark
Answers.Body: <p>We hit a new issue where it appears the Smart Group Cache table's auto increment value was too big for the id field causing smart groups not to rebuild. The AUTO_INCREMENT was up to 4294978644 which seems to be too large for maria db's unsigned int.
  Once we reset the auto increment back to 1 the table refilled. There is a discussion <a href="https://chat.civicrm.org/civicrm/pl/tf9zdd7mx7n6ib8eqxpy9rro6o" rel="nofollow noreferrer">here</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-02-24T18:24:19.323Z
Answers.LastActivityDate: 2022-02-24T18:24:19.323Z
Answers.UserDisplayName: petednz - fuzion
Answers.Body: <p>Hello there I have been reading this thread as I'm having issues with CiviCRM and not allow smart groups to refresh or cache. Keep getting the same error  message when exporting or trying to use a smart group. I also get this message when trying to update the smart group cache.</p>
  <p>I have tried to input the code in civiCRM.settings as suggested.
  I have tried to set up another scheduled job to flush and have used all the other scheduled jobs to try and flush the cache.
  I have tried to change the smart group cache timer in Admin to 0, more than 5 and 35 which is longer than the cron job runs (every half hour, Hosting doesn't allow a shorter time)</p>
  <p>error message</p>
  <p>Sorry, due to an error, we are unable to fulfill your request at the moment. You may want to contact your administrator or service provider with more details about what action you were performing when this occurred.
  DB Error: no such field</p>
  <p><strong>Log errors:</strong></p>
  <p>Log Entry for Oct 02 18:42:29
  [debug] $backTrace = #0 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Error.php(915): CRM_Core_Error::backtrace(&quot;backTrace&quot;, TRUE)
  #1 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(922): CRM_Core_Error::exceptionHandler(Object(DB_Error))
  #2 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/packages/DB.php(997): PEAR_Error-&gt;__construct(&quot;DB Error: no such field&quot;, -19, 16, (Array:2), &quot;SELECT <code>a</code>.<code>id</code> AS <code>id</code>, <code>a</code>.<code>form_values</code> AS <code>form_values</code>, <code>a</code>.<code>mapping_id</code>...&quot;)
  #3 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(575): DB_Error-&gt;__construct(-19, 16, (Array:2), &quot;SELECT <code>a</code>.<code>id</code> AS <code>id</code>, <code>a</code>.<code>form_values</code> AS <code>form_values</code>, <code>a</code>.<code>mapping_id</code>...&quot;)
  #4 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(223): PEAR-&gt;_raiseError(Object(DB_mysqli), NULL, -19, 16, (Array:2), &quot;SELECT <code>a</code>.<code>id</code> AS <code>id</code>, <code>a</code>.<code>form_values</code> AS <code>form_values</code>, <code>a</code>.<code>mapping_id</code>...&quot;, &quot;DB_Error&quot;, TRUE)
  #5 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/packages/DB/common.php(1925): PEAR-&gt;__call(&quot;raiseError&quot;, (Array:7))
  #6 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/packages/DB/mysqli.php(935): DB_common-&gt;raiseError(-19, NULL, NULL, &quot;SELECT <code>a</code>.<code>id</code> AS <code>id</code>, <code>a</code>.<code>form_values</code> AS <code>form_values</code>, <code>a</code>.<code>mapping_id</code>...&quot;, &quot;1054 ** Unknown column 'a.api_entity' in 'field list'&quot;)
  #7 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/packages/DB/mysqli.php(405): DB_mysqli-&gt;mysqliRaiseError()
  #8 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/packages/DB/common.php(1231): DB_mysqli-&gt;simpleQuery(&quot;SELECT <code>a</code>.<code>id</code> AS <code>id</code>, <code>a</code>.<code>form_values</code> AS <code>form_values</code>, <code>a</code>.<code>mapping_id</code>...&quot;)
  #9 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/packages/DB/DataObject.php(2696): DB_common-&gt;query(&quot;SELECT <code>a</code>.<code>id</code> AS <code>id</code>, <code>a</code>.<code>form_values</code> AS <code>form_values</code>, <code>a</code>.<code>mapping_id</code>...&quot;)
  #10 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/packages/DB/DataObject.php(1829): DB_DataObject-&gt;_query(&quot;SELECT <code>a</code>.<code>id</code> AS <code>id</code>, <code>a</code>.<code>form_values</code> AS <code>form_values</code>, <code>a</code>.<code>mapping_id</code>...&quot;)
  #11 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/DAO.php(421): DB_DataObject-&gt;query(&quot;SELECT <code>a</code>.<code>id</code> AS <code>id</code>, <code>a</code>.<code>form_values</code> AS <code>form_values</code>, <code>a</code>.<code>mapping_id</code>...&quot;)
  #12 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/DAO.php(1473): CRM_Core_DAO-&gt;query(&quot;SELECT <code>a</code>.<code>id</code> AS <code>id</code>, <code>a</code>.<code>form_values</code> AS <code>form_values</code>, <code>a</code>.<code>mapping_id</code>...&quot;, TRUE)
  #13 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/Civi/Api4/Query/Api4SelectQuery.php(136): CRM_Core_DAO::executeQuery(&quot;SELECT <code>a</code>.<code>id</code> AS <code>id</code>, <code>a</code>.<code>form_values</code> AS <code>form_values</code>, <code>a</code>.<code>mapping_id</code>...&quot;)
  #14 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/Civi/Api4/Generic/DAOGetAction.php(76): Civi\Api4\Query\Api4SelectQuery-&gt;run()
  #15 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/Civi/Api4/Generic/DAOGetAction.php(67): Civi\Api4\Generic\DAOGetAction-&gt;getObjects()
  #16 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/Civi/Api4/Provider/ActionObjectProvider.php(68): Civi\Api4\Generic\DAOGetAction-&gt;_run(Object(Civi\Api4\Generic\Result))
  #17 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/Civi/API/Kernel.php(150): Civi\Api4\Provider\ActionObjectProvider-&gt;invoke(Object(Civi\Api4\Generic\DAOGetAction))
  #18 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/Civi/Api4/Generic/AbstractAction.php(230): Civi\API\Kernel-&gt;runRequest(Object(Civi\Api4\Generic\DAOGetAction))
  #19 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/CRM/Contact/BAO/SavedSearch.php(214): Civi\Api4\Generic\AbstractAction-&gt;execute()
  #20 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/CRM/Contact/BAO/GroupContactCache.php(462): CRM_Contact_BAO_SavedSearch::getSearchParams(&quot;2&quot;)
  #21 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/CRM/Contact/BAO/Query.php(3160): CRM_Contact_BAO_GroupContactCache::load(Object(CRM_Core_DAO))
  #22 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/CRM/Contact/BAO/Query.php(3061): CRM_Contact_BAO_Query-&gt;addGroupContactCache((Array:1), &quot;civicrm_group_contact_cache_5f77668580a43&quot;, &quot;contact_a&quot;, &quot;IN&quot;)
  #23 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/CRM/Contact/BAO/Query.php(1820): CRM_Contact_BAO_Query-&gt;group((Array:5))
  #24 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/CRM/Contact/BAO/Query.php(2058): CRM_Contact_BAO_Query-&gt;whereClauseSingle((Array:5), FALSE)
  #25 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/CRM/Contact/BAO/Query.php(582): CRM_Contact_BAO_Query-&gt;whereClause(FALSE)
  #26 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/CRM/Contact/BAO/Query.php(529): CRM_Contact_BAO_Query-&gt;initialize(NULL)
  #27 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/CRM/Contact/BAO/Query.php(4578): CRM_Contact_BAO_Query-&gt;__construct((Array:1), (Array:1), (Array:165), TRUE, FALSE, 1, TRUE, TRUE, FALSE, NULL, &quot;AND&quot;, NULL, &quot;1&quot;)
  #28 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/CRM/Contact/BAO/GroupContactCache.php(210): CRM_Contact_BAO_Query::apiQuery((Array:1), (Array:1), NULL, NULL, 0, 0, FALSE)
  #29 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/CRM/Contact/BAO/GroupContactCache.php(192): CRM_Contact_BAO_GroupContactCache::add((Array:13))
  #30 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/api/v3/Job.php(679): CRM_Contact_BAO_GroupContactCache::loadAll((Array:0), 0)
  #31 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/Civi/API/Provider/MagicFunctionProvider.php(89): civicrm_api3_job_group_rebuild((Array:1))
  #32 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/Civi/API/Kernel.php(150): Civi\API\Provider\MagicFunctionProvider-&gt;invoke((Array:8))
  #33 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/Civi/API/Kernel.php(81): Civi\API\Kernel-&gt;runRequest((Array:8))
  #34 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/api/api.php(22): Civi\API\Kernel-&gt;runSafe(&quot;Job&quot;, &quot;group_rebuild&quot;, (Array:1))
  #35 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/JobManager.php(133): civicrm_api(&quot;Job&quot;, &quot;group_rebuild&quot;, (Array:1))
  #36 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/JobManager.php(100): CRM_Core_JobManager-&gt;executeJob(Object(CRM_Core_ScheduledJob))
  #37 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/CRM/Admin/Form/Job.php(195): CRM_Core_JobManager-&gt;executeJobById(15)
  #38 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Form.php(484): CRM_Admin_Form_Job-&gt;postProcess()
  #39 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/QuickForm/Action/Submit.php(58): CRM_Core_Form-&gt;mainProcess()
  #40 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Submit-&gt;perform(Object(CRM_Admin_Form_Job), &quot;submit&quot;)
  #41 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller-&gt;handle(Object(CRM_Admin_Form_Job), &quot;submit&quot;)
  #42 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php(335): HTML_QuickForm_Page-&gt;handle(&quot;submit&quot;)
  #43 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Page/Basic.php(395): CRM_Core_Controller-&gt;run()
  #44 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Page/Basic.php(140): CRM_Core_Page_Basic-&gt;edit(4, 15)
  #45 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/CRM/Admin/Page/Job.php(134): CRM_Core_Page_Basic-&gt;run()
  #46 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(312): CRM_Admin_Page_Job-&gt;run((Array:3), NULL)
  #47 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(68): CRM_Core_Invoke::runItem((Array:16))
  #48 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(36): CRM_Core_Invoke::_invoke((Array:3))
  #49 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm.php(1535): CRM_Core_Invoke::invoke((Array:3))
  #50 /home/customer/www/dublinfood.coop/public_html/wp-includes/class-wp-hook.php(287): CiviCRM_For_WordPress-&gt;invoke(&quot;&quot;)
  #51 /home/customer/www/dublinfood.coop/public_html/wp-includes/class-wp-hook.php(311): WP_Hook-&gt;apply_filters(&quot;&quot;, (Array:1))
  #52 /home/customer/www/dublinfood.coop/public_html/wp-includes/plugin.php(478): WP_Hook-&gt;do_action((Array:1))
  #53 /home/customer/www/dublinfood.coop/public_html/wp-admin/admin.php(259): do_action(&quot;toplevel_page_CiviCRM&quot;)
  #54 {main}</p>
  <p><strong>Log error</strong></p>
  <p>Log Entry for Oct 02 18:42:29
  [error] $Fatal Error Details = Array
  (
  [callback] =&gt; Array
  (
  [0] =&gt; CRM_Core_Error
  [1] =&gt; exceptionHandler
  )</p>
  <pre><code>[code] =&gt; -19
  [message] =&gt; DB Error: no such field
  [mode] =&gt; 16
  [debug_info] =&gt; SELECT `a`.`id` AS `id`, `a`.`form_values` AS `form_values`, `a`.`mapping_id` AS `mapping_id`, `a`.`search_custom_id` AS `search_custom_id`, `a`.`api_entity` AS `api_entity`, `a`.`api_params` AS `api_params`
  </code></pre>
  <p>FROM civicrm_saved_search a
  WHERE (<code>a</code>.<code>id</code> = &quot;2&quot;)
  [nativecode=1054 ** Unknown column 'a.api_entity' in 'field list']
  [type] =&gt; DB_Error
  [user_info] =&gt; SELECT <code>a</code>.<code>id</code> AS <code>id</code>, <code>a</code>.<code>form_values</code> AS <code>form_values</code>, <code>a</code>.<code>mapping_id</code> AS <code>mapping_id</code>, <code>a</code>.<code>search_custom_id</code> AS <code>search_custom_id</code>, <code>a</code>.<code>api_entity</code> AS <code>api_entity</code>, <code>a</code>.<code>api_params</code> AS <code>api_params</code>
  FROM civicrm_saved_search a
  WHERE (<code>a</code>.<code>id</code> = &quot;2&quot;)
  [nativecode=1054 ** Unknown column 'a.api_entity' in 'field list']
  [to_string] =&gt; [db_error: message=&quot;DB Error: no such field&quot; code=-19 mode=callback callback=CRM_Core_Error::exceptionHandler prefix=&quot;&quot; info=&quot;SELECT <code>a</code>.<code>id</code> AS <code>id</code>, <code>a</code>.<code>form_values</code> AS <code>form_values</code>, <code>a</code>.<code>mapping_id</code> AS <code>mapping_id</code>, <code>a</code>.<code>search_custom_id</code> AS <code>search_custom_id</code>, <code>a</code>.<code>api_entity</code> AS <code>api_entity</code>, <code>a</code>.<code>api_params</code> AS <code>api_params</code>
  FROM civicrm_saved_search a
  WHERE (<code>a</code>.<code>id</code> = &quot;2&quot;)
  [nativecode=1054 ** Unknown column 'a.api_entity' in 'field list']&quot;]
  )</p>
  <p><strong>CiviCRM is working fine, but cannot access or use already set up smart groups.
  Has their been a fix that I am not aware of? I can't export any contacts in that group for a mailing to go out!!</strong></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-10-02T18:37:32.103Z
Answers.Text: Hi Aaron - the idea with StackExchange is that as a Question/Answer system you are advised not to ask a Question by submitting an answer. Much better to ask a new Question and refer to existing ones, or add as a comment to an existing Answer or the original Question - but doesn't work for big posts like this
Answers.UserDisplayName: petednz - fuzion
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-10-02T17:58:26.937Z
Answers.LastActivityDate: 2020-10-02T17:58:26.937Z
Answers.UserDisplayName: Aaron Jewell
Body: <p>When I go to "manage groups", some of my smart group counts are listed as "unknown" and the notification "Count data for smart groups is not currently calculated" appears.</p>
  
  <p>Does anyone know how to address this issue? I have the smart group cache timeout set to 5 minutes and I have "Rebuild Smart Group Cache" cron job set to always run when the cron runs. The cron task runs every 15 minutes.</p>
  
  <p>I can manually click "Update Smart Group Counts", but the problem is that I have an automatic sync to Mailchimp. So whenever the smart groups fail to count themselves and Mailchimp tries to sync, it thinks everyone in the smart group unsubscribed when really Civicrm lost track of the smart group counts.</p>
  
  <p>Any help would be appreciated.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-05-25T08:47:51.077Z
Comments.Text: If your issue is with the integration with MailChimp, have you considered using the new Mosaico extension?  That avoids the sync problem and keeps everything in Civi.
Comments.UserDisplayName: Aidan
Tags: <smartgroups><cron><cache><mailchimp>
Title: Count data for smart groups is not currently calculated
ThreadText: # Count data for smart groups is not currently calculated
  
  (Asked by: username_0 on 2018-05-23)
  
  When I go to "manage groups", some of my smart group counts are listed as "unknown" and the notification "Count data for smart groups is not currently calculated" appears.
  
  Does anyone know how to address this issue? I have the smart group cache timeout set to 5 minutes and I have "Rebuild Smart Group Cache" cron job set to always run when the cron runs. The cron task runs every 15 minutes.
  
  I can manually click "Update Smart Group Counts", but the problem is that I have an automatic sync to Mailchimp. So whenever the smart groups fail to count themselves and Mailchimp tries to sync, it thinks everyone in the smart group unsubscribed when really Civicrm lost track of the smart group counts.
  
  Any help would be appreciated.
  
  **Tags:** smartgroups, cron, cache, mailchimp
  
  > **Comments:**
  > **username_1**: If your issue is with the integration with MailChimp, have you considered using the new Mosaico extension?  That avoids the sync problem and keeps everything in Civi.  
  
  ---
  
  ## 4 answers
  
  ### Answer by username_2 on 2018-05-24. Score: 1
  
  Why do you use a smart group for syncing with mailchimp? What would happen if someone unsubscribe from mailchimp?
  
  I would advise to use a normal group for a mail group, that way you are sure what would happen if someone unsubscribes (either via Mailchimp or via CiviCRM).
  
  If you need people to be automaticly subscribed to mailgroup you could use CiviRules (<https://civicrm.org/extensions/civirules>) for that.
  Documentation on CiviRules could be found at: <https://docs.civicrm.org/civirules/en/latest/>
  
  > **Comments:**
  > **username_0**: Hi Jaap,   It's because we group people dynamically based on certain data, usually membership contribution status and their geolocation.  We do a one-way upload, so if the user unsubscribers from Mailchimp, then mailchimp handles their unsubscription.  Civi rules may be a good solution, but I am still concerned about how civi is working. Is my installation broken if it can't maintain a list of smart group counts? This seems like a bug to me.  
  > **username_2**: The smart groups are a bit buggy and unstable in CiviCRM. Altough I am not a user and quite a few users use them succesfully. But I had some clients in the past where smart group counts did not work, or where the smart group caused a database deadlock. So my general advice is to stay away from smart groups.  
  
  ---
  
  ### Answer by username_3 on 2018-05-23. Score: 1
  
  This Q/A discussion "[Should Manage Groups display the Smart Group contact count, or just display it as Unknown](https://civicrm.stackexchange.com/questions/22384/should-manage-groups-display-the-smart-group-contact-count-or-just-display-it-a)" may help including following the links to read the comments for issue [CRM-21583](https://issues.civicrm.org/jira/browse/CRM-21583).
  
  > **Comments:**
  > **username_0**: I see it should say "unknown" if no cache is found. However, I think this should never happen. The moment when the cache is not found, the mailchimp extension thinks I have no more users in the mailing list and it unsubscribed everyone.  My Smart Group Timeout was set to 5 minutes and the scheduled jobs set to run every 15 minutes.  Perhaps the smart group timeout needs to be longer than the scheduled job time? I have updated the cache timeout to 20 minutes to see what happens.  
  
  ---
  
  ### Answer by username_4 on 2022-02-24. Score: 0
  
  We hit a new issue where it appears the Smart Group Cache table's auto increment value was too big for the id field causing smart groups not to rebuild. The AUTO\_INCREMENT was up to 4294978644 which seems to be too large for maria db's unsigned int.
  Once we reset the auto increment back to 1 the table refilled. There is a discussion [here](https://chat.civicrm.org/civicrm/pl/tf9zdd7mx7n6ib8eqxpy9rro6o)
  
  
  ---
  
  ### Answer by username_5 on 2020-10-02. Score: -1
  
  Hello there I have been reading this thread as I'm having issues with CiviCRM and not allow smart groups to refresh or cache. Keep getting the same error  message when exporting or trying to use a smart group. I also get this message when trying to update the smart group cache.
  I have tried to input the code in civiCRM.settings as suggested.
  I have tried to set up another scheduled job to flush and have used all the other scheduled jobs to try and flush the cache.
  I have tried to change the smart group cache timer in Admin to 0, more than 5 and 35 which is longer than the cron job runs (every half hour, Hosting doesn't allow a shorter time)
  error message
  Sorry, due to an error, we are unable to fulfill your request at the moment. You may want to contact your administrator or service provider with more details about what action you were performing when this occurred.
  DB Error: no such field
  Log errors:
  Log Entry for Oct 02 18:42:29
  [debug] $backTrace = #0 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Error.php(915): CRM_Core_Error::backtrace("backTrace", TRUE)
  #1 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(922): CRM_Core_Error::exceptionHandler(Object(DB_Error))
  #2 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/packages/DB.php(997): PEAR_Error->__construct("DB Error: no such field", -19, 16, (Array:2), "SELECT a.id AS id, a.form_values AS form_values, a.mapping_id...")
  #3 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(575): DB_Error->__construct(-19, 16, (Array:2), "SELECT a.id AS id, a.form_values AS form_values, a.mapping_id...")
  #4 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(223): PEAR->_raiseError(Object(DB_mysqli), NULL, -19, 16, (Array:2), "SELECT a.id AS id, a.form_values AS form_values, a.mapping_id...", "DB_Error", TRUE)
  #5 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/packages/DB/common.php(1925): PEAR->__call("raiseError", (Array:7))
  #6 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/packages/DB/mysqli.php(935): DB_common->raiseError(-19, NULL, NULL, "SELECT a.id AS id, a.form_values AS form_values, a.mapping_id...", "1054 ** Unknown column 'a.api_entity' in 'field list'")
  #7 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/packages/DB/mysqli.php(405): DB_mysqli->mysqliRaiseError()
  #8 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/packages/DB/common.php(1231): DB_mysqli->simpleQuery("SELECT a.id AS id, a.form_values AS form_values, a.mapping_id...")
  #9 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/packages/DB/DataObject.php(2696): DB_common->query("SELECT a.id AS id, a.form_values AS form_values, a.mapping_id...")
  #10 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/packages/DB/DataObject.php(1829): DB_DataObject->_query("SELECT a.id AS id, a.form_values AS form_values, a.mapping_id...")
  #11 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/DAO.php(421): DB_DataObject->query("SELECT a.id AS id, a.form_values AS form_values, a.mapping_id...")
  #12 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/DAO.php(1473): CRM_Core_DAO->query("SELECT a.id AS id, a.form_values AS form_values, a.mapping_id...", TRUE)
  #13 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/Civi/Api4/Query/Api4SelectQuery.php(136): CRM_Core_DAO::executeQuery("SELECT a.id AS id, a.form_values AS form_values, a.mapping_id...")
  #14 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/Civi/Api4/Generic/DAOGetAction.php(76): Civi\Api4\Query\Api4SelectQuery->run()
  #15 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/Civi/Api4/Generic/DAOGetAction.php(67): Civi\Api4\Generic\DAOGetAction->getObjects()
  #16 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/Civi/Api4/Provider/ActionObjectProvider.php(68): Civi\Api4\Generic\DAOGetAction->_run(Object(Civi\Api4\Generic\Result))
  #17 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/Civi/API/Kernel.php(150): Civi\Api4\Provider\ActionObjectProvider->invoke(Object(Civi\Api4\Generic\DAOGetAction))
  #18 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/Civi/Api4/Generic/AbstractAction.php(230): Civi\API\Kernel->runRequest(Object(Civi\Api4\Generic\DAOGetAction))
  #19 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/CRM/Contact/BAO/SavedSearch.php(214): Civi\Api4\Generic\AbstractAction->execute()
  #20 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/CRM/Contact/BAO/GroupContactCache.php(462): CRM_Contact_BAO_SavedSearch::getSearchParams("2")
  #21 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/CRM/Contact/BAO/Query.php(3160): CRM_Contact_BAO_GroupContactCache::load(Object(CRM_Core_DAO))
  #22 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/CRM/Contact/BAO/Query.php(3061): CRM_Contact_BAO_Query->addGroupContactCache((Array:1), "civicrm_group_contact_cache_5f77668580a43", "contact_a", "IN")
  #23 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/CRM/Contact/BAO/Query.php(1820): CRM_Contact_BAO_Query->group((Array:5))
  #24 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/CRM/Contact/BAO/Query.php(2058): CRM_Contact_BAO_Query->whereClauseSingle((Array:5), FALSE)
  #25 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/CRM/Contact/BAO/Query.php(582): CRM_Contact_BAO_Query->whereClause(FALSE)
  #26 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/CRM/Contact/BAO/Query.php(529): CRM_Contact_BAO_Query->initialize(NULL)
  #27 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/CRM/Contact/BAO/Query.php(4578): CRM_Contact_BAO_Query->__construct((Array:1), (Array:1), (Array:165), TRUE, FALSE, 1, TRUE, TRUE, FALSE, NULL, "AND", NULL, "1")
  #28 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/CRM/Contact/BAO/GroupContactCache.php(210): CRM_Contact_BAO_Query::apiQuery((Array:1), (Array:1), NULL, NULL, 0, 0, FALSE)
  #29 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/CRM/Contact/BAO/GroupContactCache.php(192): CRM_Contact_BAO_GroupContactCache::add((Array:13))
  #30 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/api/v3/Job.php(679): CRM_Contact_BAO_GroupContactCache::loadAll((Array:0), 0)
  #31 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/Civi/API/Provider/MagicFunctionProvider.php(89): civicrm_api3_job_group_rebuild((Array:1))
  #32 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/Civi/API/Kernel.php(150): Civi\API\Provider\MagicFunctionProvider->invoke((Array:8))
  #33 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/Civi/API/Kernel.php(81): Civi\API\Kernel->runRequest((Array:8))
  #34 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/api/api.php(22): Civi\API\Kernel->runSafe("Job", "group_rebuild", (Array:1))
  #35 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/JobManager.php(133): civicrm_api("Job", "group_rebuild", (Array:1))
  #36 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/JobManager.php(100): CRM_Core_JobManager->executeJob(Object(CRM_Core_ScheduledJob))
  #37 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/CRM/Admin/Form/Job.php(195): CRM_Core_JobManager->executeJobById(15)
  #38 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Form.php(484): CRM_Admin_Form_Job->postProcess()
  #39 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/QuickForm/Action/Submit.php(58): CRM_Core_Form->mainProcess()
  #40 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Submit->perform(Object(CRM_Admin_Form_Job), "submit")
  #41 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Admin_Form_Job), "submit")
  #42 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php(335): HTML_QuickForm_Page->handle("submit")
  #43 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Page/Basic.php(395): CRM_Core_Controller->run()
  #44 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Page/Basic.php(140): CRM_Core_Page_Basic->edit(4, 15)
  #45 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/CRM/Admin/Page/Job.php(134): CRM_Core_Page_Basic->run()
  #46 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(312): CRM_Admin_Page_Job->run((Array:3), NULL)
  #47 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(68): CRM_Core_Invoke::runItem((Array:16))
  #48 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(36): CRM_Core_Invoke::_invoke((Array:3))
  #49 /home/customer/www/dublinfood.coop/public_html/wp-content/plugins/civicrm/civicrm.php(1535): CRM_Core_Invoke::invoke((Array:3))
  #50 /home/customer/www/dublinfood.coop/public_html/wp-includes/class-wp-hook.php(287): CiviCRM_For_WordPress->invoke("")
  #51 /home/customer/www/dublinfood.coop/public_html/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters("", (Array:1))
  #52 /home/customer/www/dublinfood.coop/public_html/wp-includes/plugin.php(478): WP_Hook->do_action((Array:1))
  #53 /home/customer/www/dublinfood.coop/public_html/wp-admin/admin.php(259): do_action("toplevel_page_CiviCRM")
  #54 {main}
  Log error
  Log Entry for Oct 02 18:42:29
  [error] $Fatal Error Details = Array
  (
  [callback] => Array
  (
  [0] => CRM_Core_Error
  [1] => exceptionHandler
  )
  [code] => -19
  [message] => DB Error: no such field
  [mode] => 16
  [debug_info] => SELECT `a`.`id` AS `id`, `a`.`form_values` AS `form_values`, `a`.`mapping_id` AS `mapping_id`, `a`.`search_custom_id` AS `search_custom_id`, `a`.`api_entity` AS `api_entity`, `a`.`api_params` AS `api_params`
  
  FROM civicrm_saved_search a
  WHERE (a.id = "2")
  [nativecode=1054 ** Unknown column 'a.api_entity' in 'field list']
  [type] => DB_Error
  [user_info] => SELECT a.id AS id, a.form_values AS form_values, a.mapping_id AS mapping_id, a.search_custom_id AS search_custom_id, a.api_entity AS api_entity, a.api_params AS api_params
  FROM civicrm_saved_search a
  WHERE (a.id = "2")
  [nativecode=1054 ** Unknown column 'a.api_entity' in 'field list']
  [to_string] => [db_error: message="DB Error: no such field" code=-19 mode=callback callback=CRM_Core_Error::exceptionHandler prefix="" info="SELECT a.id AS id, a.form_values AS form_values, a.mapping_id AS mapping_id, a.search_custom_id AS search_custom_id, a.api_entity AS api_entity, a.api_params AS api_params
  FROM civicrm_saved_search a
  WHERE (a.id = "2")
  [nativecode=1054 ** Unknown column 'a.api_entity' in 'field list']"]
  )
  CiviCRM is working fine, but cannot access or use already set up smart groups.
  Has their been a fix that I am not aware of? I can't export any contacts in that group for a mailing to go out!!
  
  > **Comments:**
  > **username_4**: Hi Aaron - the idea with StackExchange is that as a Question/Answer system you are advised not to ask a Question by submitting an answer. Much better to ask a new Question and refer to existing ones, or add as a comment to an existing Answer or the original Question - but doesn't work for big posts like this  
  
  ---
  
  