# Form loading extremely slow

**URL:** <https://forum.servoy.com/t/form-loading-extremely-slow/12249>\
**Category:** Classic Servoy\
**Created:** [May 27, 2010, 10:37am UTC](https://forum.servoy.com/t/form-loading-extremely-slow/12249 "2010-05-27T10:37:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![marcelb](https://avatars.discourse-cdn.com/v4/letter/m/e95f7d/32.png) [@marcelb](https://forum.servoy.com/u/marcelb)\
**Post date:** [May 27, 2010, 10:37am UTC](https://forum.servoy.com/t/form-loading-extremely-slow/12249/1 "2010-05-27T10:37:51Z")

</div>

We have a form with a foundset based on a view which is based on multiple tables. When this form is loaded for the first time, this takes at least 5 seconds. This happens because Servoy does this query ‘select top 201 [key] from order by [key] asc’ by default. In our case the is a view with several millions of records and the [key] is a set of keys (2 fields) which are table primary keys and indexed.

This is the query:

```auto
select top 201 [Key], PriceListKey from axvwRealTimePricelistRow order by [Key] asc, PriceListKey asc

```

This query forces SQL Server to order the view in a way the indices can’t be used. We don’t want Servoy to do this query because we don’t use it, keeps the user waiting and eats a lot of our db-server processing time! When we do a search we use both keys so this is very fast.

The question here is: can we stop Servoy from doing this default query? And if not, does someone have a workaround for us?

---

<div class="post-metadata">

**Author:** ![mboegem](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/mboegem/32/4399_2.png) [@mboegem](https://forum.servoy.com/u/mboegem)\
**Post date:** [May 27, 2010, 9:13pm UTC](https://forum.servoy.com/t/form-loading-extremely-slow/12249/2 "2010-05-27T21:13:40Z")

</div>

Hi Marcel,

did you try if ```  
databaseManager.setCreateEmptyFormFoundsets()

```is

```

---

<div class="post-metadata">

**Author:** ![marcelb](https://avatars.discourse-cdn.com/v4/letter/m/e95f7d/32.png) [@marcelb](https://forum.servoy.com/u/marcelb)\
**Post date:** [May 28, 2010, 11:46am UTC](https://forum.servoy.com/t/form-loading-extremely-slow/12249/3 "2010-05-28T11:46:49Z")

</div>

Hi Marc,

Thanks, this solved the problem with this form. I had to add some record loading in several other forms, but that definitely was worth the effort to solve this problem!
