Hi
I came across this article as I have slow gravity view load times too but my database isn’t anywhere near as large - 1200 records , each about 20 fields.
I emailed gravity view and this was there response at the bottom of this post.
A key thing they mentioned was object caching that some hosting providers offer or if you have dedicated / vps you can install it yourself (redis or memcached).
I wasn’t able to speed up by disabling sorting and i think it’s because I have some custom fields in gravity view - these contain if statements and i think it means the app has to read every single entry in order to work out what to populate this custom field with. I can’t manage without the custom field so I tried upping my shared hosting to the max performance level they offered. It didn’t make much difference at all. So I’m a little stuck. Will prob end up trying this object caching.
Gravity view response:
Hi Adnaan,
The issue here is not really related to the processor or memory of your server, it’s more a matter of database design.
Gravity Forms uses mainly two tables:
- gf_entry (where it stores the id of the entry and the related form)
- gf_entrymeta (where it stores each field of each entry of each form as many individual records)
When there are no sorting or search filters, the query to pull the entries just needs to fetch the first few records from the gf_entry table (the IDs for page 1 of results). Then, using only these results, it executes a second query to pull the actual data from gf_entrymeta. This happens quickly because it’s accessing the big meta table just for the specific page 1 IDs it found on the first query.
However, when filtering or sorting, the process is a little different. It can’t limit the query by the pagination. It has to match every single ID of the gf_entry table to the corresponding meta_key on the big meta table right on the first query, so it can sort or filter the IDs by a certain value. You’ll notice that even if you filter or sort directly on your Gravity Forms Dashboard, it will take a long time to do it when you have a lot of records.
Since we use the GFAPI for retrieving entries, our query is generated directly by Gravity Forms and there isn’t much GravityView can do about it, unfortunately.
There’s also nothing conceptually wrong with this approach (of having a meta record for each field of each entry of the form). It just doesn’t scale so well for large Datasets if there isn’t any type of caching configured for it.
The only suggestion we can make is maybe not sorting by more than one field and/or trying a WP managed host, such as WP Engine. This kind of hosting can provide you with professional solutions for performance such as Object Caching and more