Thread: Regarding creation of gin index on column that has varchar datatype

Regarding creation of gin index on column that has varchar datatype

From
Durgamahesh Manne
Date:
Hi

Respected to PGDG GLOBAL TEAM

I am getting this error( ERROR:  data type character varying has no default operator class for access method "gin"
HINT:  You must specify an operator class for the index or define a default operator class for the data type ) while i try to create gin index on vch_message column of slp01 table (CREATE INDEX ON slp01 using gin(vch_message);)

vch_message column has lot of this info like  {"requestBody":{"firstName":"SALVATORE","lastName":"NAPOLITANO","email":"remuda135@hotmail.com","personID":"C48268","ClientSSN":"153520698","advisorPersonID":["10214","15270","15271","15272"]},"header":{"cache-control":"no-cache","content-type":"application/json","authorization":"Basic Y3JlYXRlVXNlcnM6ZGFrdm5laXdvbjRpOWZqb3duY3VpMzRmdW4zOTQ4aGY=","accept":"application/json, text/json, text/x-json, text/javascript, application/xml, text/xml"

NOTE:i have created pg_trgm based ginindex on this vch_message of slp01 table but it occupied more disk space hence i deleted trgm based gin index

please help in creating gin index on vch_message column  of slp01 table

Regards
Durgamahesh Manne



Re: Regarding creation of gin index on column that has varchardatatype

From
Andreas Kretschmer
Date:

Am 23.05.20 um 12:37 schrieb Durgamahesh Manne:
> Hi
>
> Respected to PGDG GLOBAL TEAM
>
> I am getting this error( ERROR:  data type character varying has no 
> default operator class for access method "gin"
> HINT:  You must specify an operator class for the index or define a 
> default operator class for the data type ) while i try to create gin 
> index on vch_message column of slp01 table (CREATE INDEX ON slp01 
> using gin(vch_message);)
>
> vch_message column has lot of this info like 
> {"requestBody":{"firstName":"SALVATORE","lastName":"NAPOLITANO","email":"remuda135@hotmail.com 
>
<mailto:remuda135@hotmail.com>","personID":"C48268","ClientSSN":"153520698","advisorPersonID":["10214","15270","15271","15272"]},"header":{"cache-control":"no-cache","content-type":"application/json","authorization":"Basic

> Y3JlYXRlVXNlcnM6ZGFrdm5laXdvbjRpOWZqb3duY3VpMzRmdW4zOTQ4aGY=","accept":"application/json, 
> text/json, text/x-json, text/javascript, application/xml, text/xml"
>
>


the string looks like JSON (with missing the correct end of the string). 
Please check. If you are storing JSON or JSONB - Values, you should use 
the proper datatype -JSON/JSONB. In this case you can create an 
GIN-Index on it.


Regards, Andreas
(and please don't email me private the same question)

-- 
2ndQuadrant - The PostgreSQL Support Company.
www.2ndQuadrant.com




Re: Regarding creation of gin index on column that has varchar datatype

From
Durgamahesh Manne
Date:


On Sat, May 23, 2020 at 6:50 PM Andreas Kretschmer <andreas@a-kretschmer.de> wrote:


Am 23.05.20 um 12:37 schrieb Durgamahesh Manne:
> Hi
>
> Respected to PGDG GLOBAL TEAM
>
> I am getting this error( ERROR:  data type character varying has no
> default operator class for access method "gin"
> HINT:  You must specify an operator class for the index or define a
> default operator class for the data type ) while i try to create gin
> index on vch_message column of slp01 table (CREATE INDEX ON slp01
> using gin(vch_message);)
>
> vch_message column has lot of this info like
> {"requestBody":{"firstName":"SALVATORE","lastName":"NAPOLITANO","email":"remuda135@hotmail.com
> <mailto:remuda135@hotmail.com>","personID":"C48268","ClientSSN":"153520698","advisorPersonID":["10214","15270","15271","15272"]},"header":{"cache-control":"no-cache","content-type":"application/json","authorization":"Basic
> Y3JlYXRlVXNlcnM6ZGFrdm5laXdvbjRpOWZqb3duY3VpMzRmdW4zOTQ4aGY=","accept":"application/json,
> text/json, text/x-json, text/javascript, application/xml, text/xml"
>
>


the string looks like JSON (with missing the correct end of the string).
Please check. If you are storing JSON or JSONB - Values, you should use
the proper datatype -JSON/JSONB. In this case you can create an
GIN-Index on it.


Regards, Andreas
(and please don't email me private the same question)

--
2ndQuadrant - The PostgreSQL Support Company.
www.2ndQuadrant.com


Hi Andreas

Thank you for this information


Regards

Durgamahesh Manne