<p>I'm looking to get some advice on excessively duplicated database queries when selecting single types in Craft CMS</p>
<p>Our craft instance keeps timing out when trying to load the home page single entry, so I was doing some debugging locally with the debug toolbar and a fresh DB and noticed that we have over 800 duplicate queries for this entry (even on a fresh DB with no content), this seems a bit excessive?</p>
<p>Currently running:</p>
<ul>
<li>Craft Pro 3.7.15</li>
<li>Neo 2.11.13</li>
<li>Element API 2.8.0</li>
<li>SuperTable 2.6.8</li>
<li>SEO 3.4.15</li>
</ul>
<p>Our home page only has 3 fields:</p>
<ol>
<li>Title (text)</li>
<li>Seo (SEO Settings)</li>
<li>Blocks (NEO blocks) which has 36 block types</li>
</ol>
<p><strong>If I remove the blocks field I get the following in the debug tool:</strong>
<a href="https://i.sstatic.net/UbicC.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/UbicC.png" alt="enter image description here" /></a></p>
<p><strong>But if I re-add the NEO blocks field I get this:</strong>
<a href="https://i.sstatic.net/PFAak.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/PFAak.png" alt="enter image description here" /></a></p>
<p>Are results like this normal? Especially when theres no content saved? These results are even worse in a PROD env when trying to load the home page entry with content.</p>
<p><a href="https://i.sstatic.net/P9zdO.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/P9zdO.png" alt="enter image description here" /></a></p>
<p><a href="https://i.sstatic.net/yj4wS.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/yj4wS.png" alt="enter image description here" /></a></p>
<p><a href="https://i.sstatic.net/fN3dh.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/fN3dh.png" alt="enter image description here" /></a></p>
<p><a href="https://i.sstatic.net/98atM.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/98atM.png" alt="enter image description here" /></a></p>
<p>Perhaps our implementation of Neo blocks is wrong and causing way to many queries?</p>
<p>Any help is appreciated, thanks in advance!</p>

CC BY-SA 4.0
2022-02-21T23:43:55.040Z
In the debug toolbar, sort the database queries by the duplicated column descending. Do the worst duplicated query offenders give you an idea of where they might be coming from? Can you edit the question to share some of them?
Brad Bell
CC BY-SA 4.0
2022-02-22T01:26:14.077Z
Hi @BradBell, thanks for your comment. I've added some extra screenshots of some of the queries. Worst offenders seem to be SELECT queries related to fields. Thanks heaps
Kyle Lambert
<craft3><queries><plugin-neo><timeout>
Duplicate database queries and timeouts
# Duplicate database queries and timeouts

(Asked by: username_0 on 2022-02-21)

I'm looking to get some advice on excessively duplicated database queries when selecting single types in Craft CMS

Our craft instance keeps timing out when trying to load the home page single entry, so I was doing some debugging locally with the debug toolbar and a fresh DB and noticed that we have over 800 duplicate queries for this entry (even on a fresh DB with no content), this seems a bit excessive?

Currently running:

* Craft Pro 3.7.15
* Neo 2.11.13
* Element API 2.8.0
* SuperTable 2.6.8
* SEO 3.4.15

Our home page only has 3 fields:

1. Title (text)
2. Seo (SEO Settings)
3. Blocks (NEO blocks) which has 36 block types

**If I remove the blocks field I get the following in the debug tool:**
[![enter image description here](https://i.sstatic.net/UbicC.png)](https://i.sstatic.net/UbicC.png)

**But if I re-add the NEO blocks field I get this:**
[![enter image description here](https://i.sstatic.net/PFAak.png)](https://i.sstatic.net/PFAak.png)

Are results like this normal? Especially when theres no content saved? These results are even worse in a PROD env when trying to load the home page entry with content.

[![enter image description here](https://i.sstatic.net/P9zdO.png)](https://i.sstatic.net/P9zdO.png)

[![enter image description here](https://i.sstatic.net/yj4wS.png)](https://i.sstatic.net/yj4wS.png)

[![enter image description here](https://i.sstatic.net/fN3dh.png)](https://i.sstatic.net/fN3dh.png)

[![enter image description here](https://i.sstatic.net/98atM.png)](https://i.sstatic.net/98atM.png)

Perhaps our implementation of Neo blocks is wrong and causing way to many queries?

Any help is appreciated, thanks in advance!

**Tags:** craft3, queries, plugin-neo, timeout
> **Comments:**
> **username_1**: In the debug toolbar, sort the database queries by the duplicated column descending. Do the worst duplicated query offenders give you an idea of where they might be coming from? Can you edit the question to share some of them?  
> **username_0**: Hi @BradBell, thanks for your comment. I've added some extra screenshots of some of the queries. Worst offenders seem to be SELECT queries related to fields. Thanks heaps  

---

## 0 answers

