Spread the love

List Rows vs Get Row by Id

In the Power Automate Dataverse, developers will become all too familiar with two key actions:

What I’ve noticed is a lot of flows are created that retrieve 1 record from a dataverse table. Sometimes the “Get a row by ID” action was used; other times “List rows” was used.

A pattern I’ve come across is the “List rows” actions had a sole filter being the unique identifier. That guarantees 1 record in the result set. Unfortunately, to get the value from that one record, Power Automate automatically adds in an “Apply to each” loop.

Extra step; extra code to process; extra computing time spent.

Or is it?

That’s where this curious consultant’s test came about.

This post is going to benchmark List Rows vs Get a row by ID in Power Automate to see if there’s a major difference in performance between the two actions retrieving 1 record.

 

The flow’s set up

Here is the overall flow:
Power Automate - List Rows vs Get Row by Id

Breaking it down a bit further:

Power Automate - List Rows vs Get Row by Id

The manual trigger takes two parameters:

  • a Unique Id to query the out of the box Contacts table for a specific record
  • an integer value of either 0 or 1:
    • 1 tells the flow to use the List Rows action;
    • 0 tells the flow to use the Get row by Id action.

The variables are initialized and we then check to see which action method to use:
Power Automate - List Rows vs Get Row by IdPower Automate - List Rows vs Get Row by Id

Once determined, the dataverse table will be queried using the relevant action.

To force the flow to do something, a Compose action is implemented to write values out.

At the end of all this:

  • we capture the end time using utcNow()
  • do a date difference to determine how long it took the flow to run
  • then use the Compose action again to display the results

 

Assumptions:

  1. No error checking
  2. The record exists in the out of the box “Contacts” table.
  3. Both actions query the unique-identifier to eliminate as much discreptancies as possible between how queries are structured

 

How the tests were run:

  1. In a sandbox environment
  2. The actual flow was run once every 15 minutes to prevent frequent usage and any unknown caching affecting the results
  3. The runs were alternated between using the “List rows” and “Get a row by ID” in attempts to again limit potential caching Microsoft may have implemented
  4. Run times were just a simple date difference calculation between the Start time and End time
  5. The end times were determined to be after the completion of the last Compose action. Realistically, this simulates the data being used in at least 1 action after a query. Otherwise, what’s the point of having a query?

 

The results

As you can see from the results below, the “Get row by Id” won 2/3 races, and by a clear margin. The first run it lost just by a little bit.

 

Run #

 

1

2

3

List Rows

00:00.6762243

00:00.5119403

00:00.3978599

Get row by Id

00:00.6874104

00:00.3363939

00:00.2663491

Here’s screen captures from each individual run:

List Rows:
Power Automate - List Rows vs Get Row by IdPower Automate - List Rows vs Get Row by IdPower Automate - List Rows vs Get Row by Id

 

Get row by Id:
Power Automate - List Rows vs Get Row by IdPower Automate - List Rows vs Get Row by IdPower Automate - List Rows vs Get Row by Id

 

Summing Up

From the results above, anyone looking for speed should definitely use the “Get row by Id” action whenever possible when retrieving one record from a dataverse table.

That concludes our benchmark List Rows vs Get a row by ID in Power Automate tests.

If you have any comments, please leave them below!

Otherwise, happy Power Automating. 🙂

 

(Visited 303 times, 1 visits today)

Spread the love
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
0
Would love your thoughts, please comment.x
()
x