Re: [PERFORM] GIN index not used if created in the same transaction as query

2017-05-19 Thread Tom Lane
Adam Brusselback writes: > Is there any easy way I can know if an index is usable or not? Are there > any catalog views or anything I could check that in? IIRC, you can look at pg_index.indcheckxmin --- if that's set, then the index had broken HOT chains during creation and may not be usable righ

Re: [PERFORM] GIN index not used if created in the same transaction as query

2017-05-19 Thread Adam Brusselback
> > Does the "multiple steps" part involve UPDATEs on pre-existing rows? > Do the updates change the column(s) used in the gin index? > Yes they do, however the updates happen prior to the index creation. I just tried, and that looks like the solution. I really appreciate your help on this. Is

Re: [PERFORM] GIN index not used if created in the same transaction as query

2017-05-19 Thread Tom Lane
Adam Brusselback writes: > I have a function which builds two temp tables, fills each with data (in > multiple steps), creates a gin index on one of the tables, analyzes each > table, then runs a query joining the two. > My issue is, I am getting inconsistent results for if the query will use > th

[PERFORM] GIN index not used if created in the same transaction as query

2017-05-19 Thread Adam Brusselback
Hey all, first off, i'm running: PostgreSQL 9.6.3 on x86_64-pc-linux-gnu, compiled by gcc (Debian 4.9.2-10) 4.9.2, 64-bit At the high level, I am having an issue with a query not using an index, and in a very hard to reproduce way. I have a function which builds two temp tables, fills each with d

Re: [PERFORM] GIN index not used

2014-07-12 Thread Emre Hasegeli
> -Original Message- It is hard to read your message. You should indicate the quoted lines. Please fix your email client. > About the contrib/intarray, do I have other choices not using that one? integer[] and contrib/intarray are two different data types. > About the join, yeah, in ou

Re: [PERFORM] GIN index not used

2014-07-10 Thread Huang, Suya
-Original Message- From: Tom Lane [mailto:t...@sss.pgh.pa.us] Sent: Friday, July 11, 2014 3:43 PM To: Huang, Suya Cc: Andreas Kretschmer; pgsql-performance@postgresql.org Subject: Re: [PERFORM] GIN index not used "Huang, Suya" writes: > Just found out something

Re: [PERFORM] GIN index not used

2014-07-10 Thread Tom Lane
"Huang, Suya" writes: > Just found out something here > http://www.postgresql.org/message-id/17021.1234474...@sss.pgh.pa.us > So I dropped the index and recreate it by specifying: using gin(terms_ts > gin__int_ops) and the index works. Oh, you're using contrib/intarray? Pursuant to the threa

Re: [PERFORM] GIN index not used

2014-07-10 Thread Huang, Suya
-Original Message- From: Tom Lane [mailto:t...@sss.pgh.pa.us] Sent: Friday, July 11, 2014 2:56 PM To: Andreas Kretschmer Cc: Huang, Suya; pgsql-performance@postgresql.org Subject: Re: [PERFORM] GIN index not used Andreas Kretschmer writes: > Huang, Suya wrote: >> I’ve got a t

Re: [PERFORM] GIN index not used

2014-07-10 Thread Andreas Kretschmer
Tom Lane wrote: > What PG version is this? What non-default planner parameter settings are > you using? (Don't say "none", because I can see you've got enable_seqscan > turned off.) LOL, right ;-) Andreas -- Really, I'm not out to destroy Microsoft. That will just be a completely unintentio

Re: [PERFORM] GIN index not used

2014-07-10 Thread Tom Lane
Andreas Kretschmer writes: > Huang, Suya wrote: >> I’ve got a table with GIN index on integer[] type. While doing a query with >> filter criteria on that column has GIN index created, it’s not using index >> at >> all, still do the full table scan. Wondering why? > Btw.: works for me: Yeah

Re: [PERFORM] GIN index not used

2014-07-10 Thread Andreas Kretschmer
Huang, Suya wrote: > Hi, > > > > I’ve got a table with GIN index on integer[] type. While doing a query with > filter criteria on that column has GIN index created, it’s not using index at > all, still do the full table scan. Wondering why? Try to add an index on the date-column. Btw.: work

[PERFORM] GIN index not used

2014-07-10 Thread Huang, Suya
Hi, I've got a table with GIN index on integer[] type. While doing a query with filter criteria on that column has GIN index created, it's not using index at all, still do the full table scan. Wondering why? Table is analyzed. dev=# \d+ booking_weekly Table "booking