Team, We are using full text search functionality...
# orm-help
m
Team, We are using full text search functionality of Prisma with Postgresql. If I have a table like below CREATE TABLE Configs ( id serial4 NOT NULL primary key, config text NULL ); It has a text index like below. CREATE INDEX ix1 ON Configs USING GIN (to_tsvector(‘simple’::regconfig, config)); And when using GraphQL query on this table below query { findManyConfigs(take:100, where: { config: { search: “xxxxx” } }) { id } } It is executing query something like below on database. SELECT “schemaname”.“Configs”.“id”, “schemaname”.“Configs”.“config” FROM “schemaname”.“Configs” WHERE to_tsvector(concat_ws(' ’, “schemaname”.“Configs”.“config”)) @@ to_tsquery(‘xxxxx’) ORDER BY “schemaname”.“Configs”.“id” ASC LIMIT 100 OFFSET 0; But it is not able to use the index that was created on table. And we could not create a function based index to_tsvector(concat_ws(' ’, “schemaname”.“Configs”.“config”)) because the functions are not IMMUTABLE. Is there a way that we can make prisma generated queries to use the text based index on the table? Or suggestions on what index need to be created to have optimized execution of prisma generated query. Thank you for the help.
n
Hey Murty 👋 you might be hitting the same problem that’s described in this issue: https://github.com/prisma/prisma/issues/8950 If that’s the case, would you mind adding a comment and a 👍 to the issue, this helps our Engineering teams prioritize what to work on 🙂
m
Thank you Nikolas for the reply. I do not know why I did not get this bug in google search. I commented and did 👍.
🙏 1
n
Great, thanks a lot!!
👍 1