# Google Sheet and Airtable queries seem slow on first query

**URL:** <https://community.thunkable.com/t/google-sheet-and-airtable-queries-seem-slow-on-first-query/2728189>\
**Category:** Questions about Thunkable X\
**Created:** [November 29, 2023, 12:00am UTC](https://community.thunkable.com/t/google-sheet-and-airtable-queries-seem-slow-on-first-query/2728189 "2023-11-29T00:00:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![steve\_synopsis](https://avatars.discourse-cdn.com/v4/letter/s/48db29/32.png) [@steve\_synopsis](https://community.thunkable.com/u/steve_synopsis)\
**Post date:** [November 29, 2023, 12:00am UTC](https://community.thunkable.com/t/google-sheet-and-airtable-queries-seem-slow-on-first-query/2728189/1 "2023-11-29T00:00:19Z")

</div>

Hi,

I have a datasource (56 rows, 4 columns) both in Google Sheets and Airtable and am running a simple query. I enter an SKU and the code loops through the data until the entered SKU matches the SKU in the row. At that point I break out of the loop and display the data.

What I have found is that if I search for the last SKU in row 56, the search takes about 22 seconds, but a subsequent search to row 55 in the same app session takes just over 1 second. I am assuming that this some sort of caching but how can I correct it so that the first run is quicker?

This happens in both Google Sheets and Airtable.

 ![2023-11-28 19 46 56](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/9/096b05769f4c5773522ae8845e9504919fbf61a1.png)

A link to a screen share is [here](https://somup.com/c0Xu0NgpqU)

Thanks  
Steve

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [November 29, 2023, 3:32am UTC](https://community.thunkable.com/t/google-sheet-and-airtable-queries-seem-slow-on-first-query/2728189/2 "2023-11-29T03:32:37Z")

</div>

There’s a much easier way to do this.

The [Find First Occurrence of](https://docs.thunkable.com/blocks/blocks/lists#find-first-last-occurrence) block will return a 0 if the search term doesn’t exist and a number greater than 0 if it does. That number represents the row number where the term was found. You can use that block with the [List of Values](https://docs.thunkable.com/blocks/app-features/data-sources-blocks#list-of-value-in-block-overview) block to quickly determine if the value exists in a column in your data source.

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/3/4311fb48473f59138a1a7d84cdd93a9804ef1773.png)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/f/0f59f292712368bce16ff80133ae10de8a6f27e8.png) [@system](https://community.thunkable.com/u/system)\
**Post date:** [February 27, 2024, 3:33am UTC](https://community.thunkable.com/t/google-sheet-and-airtable-queries-seem-slow-on-first-query/2728189/3 "2024-02-27T03:33:04Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
