Answer the question
In order to leave comments, you need to log in
Is it possible to display the number of unique words in a table?
Hello. Tell me, is it possible to display a list of unique words and their number in the table?
There is a text column that can contain either one word or several sentences. A full-text index gin_trgm_ops was created on this column, which, as far as I know, divides all the lines into separate words. But how to make a query (and whether it is possible) to display individual words and their number is not clear.
Answer the question
In order to leave comments, you need to log in
select lexeme, count(*) from tabledata cross join unnest(to_tsvector(data)) as lexemes group by 1;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question