cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
rwittels
Resolver I
Resolver I

Very slow gallery sort when displaying SQL records

I have a very simple test app which has a camera control, takes a photo and uploads it as base64 to a varchar field in SQL. The table also has a Date, Name and File Name column which are patched with the image data. The app works as expected until I try and view the gallery or sort it by Date, Name or File Name. The gallery template displays the Image, Date, Name and File Name. The gallery takes about 20 seconds to load the data and when I click the sort button, it takes about 15 seconds each time to do the sort. I only have 4 records in my table!
My gallery items property is

 

Sort(ImageList,Date,If(SortAscending,Ascending,Descending))

 

and my sort button OnSelect property is

 

UpdateContext({SortAscending: !SortAscending})

 

I have had a look at this article but don't see anything that might help me:
Considerations for optimized performance in Power Apps
Should I be saving my loaded gallery items to a collection?
When using Excel or SharePoint as a data source, with a lot more records, a sort takes less than a second.

UPDATE: I did find this article which seems a bit more relevant. I will try this method and report the results:

Performance considerations with PowerApps 

1 ACCEPTED SOLUTION

Accepted Solutions
rwittels
Resolver I
Resolver I

The second article I linked to is probably the best performance advice you will get with regard to loading SQL data into your Power App.

I added this at the App OnStart property:

ClearCollect(imageData, ImageList)

I changed my gallery Items property to this:

Sort(imageData, Date, If(SortAscending,Ascending,Descending))

On app start the data takes about 15 to 20 seconds to load into the collection, which I can indicate to the user with a loading animation, but subsequent gallery interactions, such as sorting, are instant.

 

View solution in original post

2 REPLIES 2
rwittels
Resolver I
Resolver I

The second article I linked to is probably the best performance advice you will get with regard to loading SQL data into your Power App.

I added this at the App OnStart property:

ClearCollect(imageData, ImageList)

I changed my gallery Items property to this:

Sort(imageData, Date, If(SortAscending,Ascending,Descending))

On app start the data takes about 15 to 20 seconds to load into the collection, which I can indicate to the user with a loading animation, but subsequent gallery interactions, such as sorting, are instant.

 

View solution in original post

rwittels
Resolver I
Resolver I

As I add records it takes a little longer to load into the collection. This is an obvious observation however, it takes 22 seconds to load 8 records. How long will it take to load 100 records or 500? Surely there is something I am missing here or is SQL performance in Power Apps just this bad?

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (1,260)