Common Table Expression in Blazebit #1791
-
Hi, we were using Solr to store some information and we were using the faceted information returned in the queries. We have moved that persistence to database and now we need to get something similar.
But I can't find any example to make it with Blazebit. We have already made queries with recursive CTEs successfully. If this is not possible, I had thought of making several queries with their respective repeated filters, but I prefer to avoid it since I consider that this way is more optimal. Thanks in advance |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
Here you can find the documentation for working with CTEs: https://persistence.blazebit.com/documentation/1.6/core/manual/en_US/#ctes Not sure what you are trying to achieve exactly, but maybe it's easier to create a CTE for the facets and join + aggregate the data against that. Something like |
Beta Was this translation helpful? Give feedback.
-
Hi again @beikov! and sorry to bother you! Reading the documentation about CTE and trying the example with a query like this
is generating the following query (what getQueryString method shows):
And this is the query that is sent to the database (postgresql)
but in the documentation shows that it should be with the "with AuditLogCte" structure I think I'm happy with the other proposed solution, but I'm curious to get the cte query working. |
Beta Was this translation helpful? Give feedback.
Query plans look roughly the same to me, so yeah, should be fine!