Appropriate approach for better performance. SQL vs transform?

Hello,

I am interested in knowing which solution is more appropriate for better performance.

In a Perspective table, I have data retrieved using a named query. I want to add a button to each row of the table that will open a popup window displaying data from that specific row.

Question:
Is it better to add a dummy column "button" to the SQL table,
or is it better to write a script that adds a new dummy column using binding transform?

script example:

def transform(self, value, quality, timestamp):
    ret = []
    for key in value.keys():
        row = dict(value[key])
        row["open"] = key
        ret.append(row)
    return ret

Thank you for your assistance!

The SQL approach is free.
The Script Transform approach requires loading up the Jython interpreter. It will be slower.

Great! That's exactly what I needed to know!

I'll try to give some input on a part of your post you weren't even asking about :person_shrugging:

I found that having a column with a button to launch a popup is actually not the best way to do it, in practice. If your dataset returns 1000 or so rows and you scroll quickly, you'll see the button's default state without any styling you may have added on top, and it looks pretty ugly. Also, what if the dataset grows (meaning more columns get added) and then you have to scroll to see the button column?

What I started doing instead is to have a single button that will launch the info popup and to use the Table's selectionData property, just like you would use rowData the way you're doing it now.

Something like

8 Likes