Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Everyone,
In my app script I'm planning to count rows from a table in our Postgres DB.
I have a dilemma how to do this action:
First option:
BC_SOURCE_MATCH_COUNT_NEW_RECORDS:
Select count(objectid) as "NumberOfRecords"
FROM "brief"."bc_bi_source_match"
Second Option:
BC_SOURCE_MATCH_COUNT_NEW_RECORDS:
LOAD count(objectid) as "NumberOfRecords";
Select objectid
FROM "brief"."bc_bi_source_match"
Which method is better in terms of performance?
Thanks.
It depends on various factors like performance and workload of your db and the network and so on which approach to count the number of records is most suitable - especially as it's probably only one step in your task-chain. I think I wouldn't do it in this way else trying to query the metadata of your table. In Qlik you could use noofrows() and I assume that the postgres provide a similar way to get this information.
- Marcus
Thanks @marcus_sommer , Just an update - I will have a WHERE clause when performing this count so I'm not sure that query the metadata is feasible (I assume it's based on a statistical table in Posgres).
Am I right?
That changes the case. If you load these data anyway in Qlik you could remain by noofrows() and if not it might be the best to perform it within the db - but without testing the various ways (in a real-case scenario) you won't know which is the most performant way.
- Marcus