# Database performance issue

**URL:** <https://help.nextcloud.com/t/database-performance-issue/19583>\
**Category:** ℹ️ Support\
**Created:** [August 14, 2017, 9:41am UTC](https://help.nextcloud.com/t/database-performance-issue/19583 "2017-08-14T09:41:46Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![muppeth](https://help.nextcloud.com/user_avatar/help.nextcloud.com/muppeth/32/3504_2.png) [@muppeth](https://help.nextcloud.com/u/muppeth)\
**Post date:** [August 15, 2017, 11:08pm UTC](https://help.nextcloud.com/t/database-performance-issue/19583/3 "2017-08-15T23:08:37Z")

</div>

Yes. I use both redis and apcu for caching. At the moment my contacts size is:  
`select COUNT(*) from oc_cards;` - 43615  
`oc_addressbooks;` - 2099  
`oc_adressbookchanges;` - 426194  
`oc_cards_properties ;` - 203849

Mysqltunner yells there is 6570722 joins performed without indexes atm.  
I’m worndering if that’s normal since the developer guide mentions to always use indexes. Most of the queries in slow log are like:

```auto
SELECT `id`, `uri`, `lastmodified`, `etag`, `size`, `carddata` FROM `oc_cards` WHERE (`addressbookid` = '1493') AND (`uri` = '.4caa34af-99af-4a3b-9e24-5c2bc1d02342.vcf') 

```

I’ve moved that DB to test a server where only one user was logged in, and the results were pretty much the same. When using calendars, activities, db is responsive and quite fast. The moment I go to contacts the cpu grind starts. Creating/deleting contact takes about 4 sec. to complete.

If there is anything I should check or troubleshoot let me know. I need suggestions or hints to change my perspective on the issue, Maybe I’m missing something obvious. Atm I cache the entire database (4GB) in RAM with `innodb_buffer_pool_size`, but that seem to not improve much. My `innodb_log_file_size` is set quite high (512MB) so there is not that much disk IO. Mysqltunner suggest to crank up `join_buffer_size` which I did to 2MB, but seems like it could be easily 32MB and mysqltuner would suggest increasing (should I?).

---

_[View the full topic](https://help.nextcloud.com/t/database-performance-issue/19583)._
