Closed EyMaddis closed 5 years ago
Hmm– I am planning to look more at this tomorrow, but it seems like using expression indexes might make some use cases like this possible?
@danscan expression indexes are nice, but only possible when it is not relying on any other data than the row. Basically for this to work, there could also be a trigger that just sets the value on Update/Insert. But the power is when it happens at query time, as this could even access other tables.
This could be implemented as a plugin in v4.
Relates also to https://github.com/graphile/postgraphile/issues/386
I think we can use indexes to detect the computed columns that are suitable for use in both conditions and order by.
4.3.1 added support for filtering and ordering by single-argument computed columns:
https://github.com/graphile/postgraphile/releases/tag/v4.3.1
Hi, currently the queries for computed property functions are evaluated after the data was fully loaded, leading to N+2 and weird error behaviour (#375) :
This can be achieved with a single request, based on a StackOverflow answer:
The same approach can be used in
WHERE
clauses, so the condition types in PostGraphQL can also be amended. Currently conditions onallMyType(condition: {...})
can only include non-computed properties. Example for using a computed property in a condition:This might be more tricky when it comes to allowing parameters for the computed properties, like the summary property in the forum example.
PS: I also ran it against #342, which puts this into one CTE (🎉) , but it still split up into two
SELECT
statements.