Last epic solved!
In the first Grafast Working Group, we outlined 4 major issues in Grafast that needed to be addressed before we could think about general release. The fourth, and final, epic has now been solved!
- ✅ Global dependencies — solved via “unary” steps
- ✅ Early exit — solved via “flags”
- ✅ Eradicating eval
- ✅ Polymorphism — this release!
Grafast is the cutting-edge GraphQL planning and execution engine which PostGraphile uses, allowing it to build much more efficient SQL queries than PostGraphile V4 could achieve, whilst also significantly expanding the capabilities of the system - not to mention solving some longstanding issues!
Polymorphism epic achieved
In previous versions of Grafast there was the possibility of exponential plan branching due to the naive method of resolution of abstract types.
By moving the responsibility of polymorphic resolution from field plan resolvers into the abstract types themselves, we’ve centralized this logic, simplified field plan resolvers, and unlocked more optimization opportunities and greater execution efficiency. Polymorphic branches in one layer are now merged into a single “combined” step before planning the next level of polymorphism.
On the right is the new handling of polymorphic resolution.
getPetIds
and getServiceAnimals
both fetch an
Animal
ID and so they are combined together in order to fetch all
of the required Animals by their IDs. Once the IDs are fetched, the nodes can
branch out to the different Animal types.