Comments (3)
I imagine the API will likely be designed such that it will never return more than x
number of items for a given request, where x
is some default maximum value that we deem "safe" enough to keep the database responsive.
If we want to get the total count of a particular thing, without actually getting all those things, I would highly recommend a separate API request specifically for the count. This could be done with either a different API endpoint (REST resource) or with a query param on the endpoint. I think it would be a bit cleaner if it were an entirely separate thing.
Having the count be computed independently from fetching all of the rows themselves allows us flexibility to change how the count is computed/stored/retrieved completely separately from the actual query to fetch the data. For certain tables that will always be small, the query may simply do a select count(*)
every time.
We should think at scale here though, and assume that some members may have many millions of records. We don't want someone loading the UI page to bog down the whole database while it goes and tries to count all those rows every time.
Also, counting rows is known to be a thing that PostgreSQL is not good at with large tables https://wiki.postgresql.org/wiki/Slow_Counting This may have changed in newer versions. The last time I ran into problems with PostgreSQL counting rows was probably 4 years ago, so things may have improved or there may be other ways now. But it's definitely something we need to spend some time researching and testing if we want to go this route.
from firefly.
re-opening this after discussion with @shorsher - the UI needs the ability to get the counts scoped to different resource types, within individual namespaces, but will mitigate the performance issue by always performing queries bounded to a time window.
from firefly.
#150 raised with the API work @shorsher
Once the UI explorer side has worked out where the counts are needed, and we've added filtering in the table/timeline experience, we'll want to come back round and make sure we have the right indexes in place on timeboxing/filtering.
Rather than putting those in speculatively, I'd like to use the UI to test them - maybe combined with loading up a few million transactions into a system first to do some PSQL profiling.
from firefly.
Related Issues (20)
- Status call returns error when node is not registered to a multiparty namespace HOT 2
- Protocol ID behaviour inconsistent with docs HOT 3
- Migration Issue with ERC-1155 Token Pools HOT 5
- FireFly gets stuck processing events from an unknown listener HOT 1
- FireFly 1.3 Performance Testing HOT 7
- Transaction failure reason not visible when using fixed gas amount HOT 8
- Intermittent Unit Test - TestDownloadManagerStartupRecoveryCombinations
- Hardening for 1.3 Release HOT 8
- Error for "unable to resolve contract method" has a missing string
- Enhance documentation with signing knowledge
- Enhance multiparty documentation HOT 1
- FireFly does not attempt to re-connect to token connectors on Namespace startup retry
- FireFly requires a signing key for "query" operations
- Broadcast are stuck whilst running performance testing against 1.3.0-rc1 HOT 2
- Need to document the FF1.3 revert error handling, and make the default safer HOT 11
- GET API(s) response doesn't include a REST endpoint in urls
- Fix `latest` tag in Docker image workflows
- Improve multi-party status information (if enabled) to aid registration automation HOT 2
- Build broken on main
- Google search results for docs not going to /latest HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from firefly.