Form opening time too high


As the title says, I have a Products table, and several relationships, to bring information to the screen. I would like to know if there is anything to help me with this.
I’m using C9.1 and PostgreSQL.
The Form takes a few seconds to open.

The opening of the form itself to display the fields from the products table is unlikely to be the source of your problem. What is the role of those “several relationships”.? Do they populate drop-down list-boxes, just grab a field for display from a matching table? I think the most likely culprit is a query to populate a browse of some sort on the form that a) gets data from a large table and b) has a bad query. Where a common cause of a bad query is an order by clause that does not match any of the keys you have defined in the database. Often a sorting that is case-insensitive (i.e. on upper(somefield) when your database index is on somefield.

1 Like

You will quickly know if the slowness is from your Clarion app by comparing the return time of the same queries using PG Admin.

1 Like

No, no! I use it to relate data, using a unique key, such as
Product → Brand
Product → Group
Product → Subgroup
Product → Supplier
And Others tables…

I am using the Clarion Standard to bring, using a query via SQL(…), like this:


!Monta SQL Query
LOC:Query = ''
LOC:Query = 'SQL(1=1'

IF LOC:Codigo > 0
    LOC:Query = LOC:Query & ' AND ID = ' & CLIP(LOC:Codigo)

IF LOC:NumBanco <> ''
    LOC:Query = LOC:Query & ' AND numero ILIKE<39>%' & CLIP(LOC:NumBanco) & '%<39>'

IF LOC:Nome <> ''
    LOC:Query = LOC:Query & ' AND nome ILIKE<39>%' & CLIP(LOC:Nome) & '%<39>'

LOC:Query = LOC:Query & ')'


BRW1.ResetSort(true) !Força um recarregamento.

Of course, this is a smaller Query, to search for Bank and Account

Have you checked what Clarion is passing to PG using Trace?

1 Like

Are your related Tables and Main table located in the same database? so the same connection is used for ALL your tables

yes, all on same database, using a GLO:ConnString

1 Like

That doesn’t really answer Douglas’s question: if you take the constructed queries out of the trace file, do they run quickly or slowly in PgAdmin? That’s also related to my point about the order by in thew query.

I’m also going to guess that, on entering the form, all those LOC: variables are going to be blank/0 so on entry you are going to be asking for the full data set for each one of those browses, because your filter would just be (1=1)?

1 Like