Re: [PERFORM] Performance Issue -- "Materialize"

2017-08-21 Thread Jeff Janes
On Sat, Aug 19, 2017 at 10:37 AM, anand086 wrote: Your email is very hard to read, the formatting and line wrapping is heavily mangled. You might want to attach the plans as files attachments instead of or in addition to putting the in the body. > -> Index Only Scan using ui_nkey_test_tab on

Re: [PERFORM] Performance Issue -- "Materialize"

2017-08-21 Thread Carlos Augusto Machado
I think you query is a bit confusing and have many subqueries, so I tried to simplify If you cant´t have more import_num = 0 to the same login, try this SELECT count(*) FROM test_tab tab1 LEFT JOIN test_tab tab2 ON tab1.login = tab2.login AND tab2.import_num = '0' WHERE tab2.login IS NULL

Re: [PERFORM] Performance Issue -- "Materialize"

2017-08-21 Thread Carlos Augusto Machado
Do you have an index on login column ? If not, try creating an index and taking off those DISTICTs. Em seg, 21 de ago de 2017 às 15:33, Justin Pryzby escreveu: > On Sat, Aug 19, 2017 at 10:37:56AM -0700, anand086 wrote: > > > +

Re: [PERFORM] Performance Issue -- "Materialize"

2017-08-21 Thread Justin Pryzby
On Sat, Aug 19, 2017 at 10:37:56AM -0700, anand086 wrote: > +---+| > > QUER

Re: [PERFORM] Performance Issue -- "Materialize"

2017-08-21 Thread anand086
Any thoughts on this? -- View this message in context: http://www.postgresql-archive.org/Performance-Issue-Materialize-tp5979128p5979481.html Sent from the PostgreSQL - performance mailing list archive at Nabble.com. -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.o

[PERFORM] Performance Issue -- "Materialize"

2017-08-19 Thread anand086
I am a Postgres Newbie and trying to learn :)We have a scenario wherein, one of the SQL with different input value for import_num showing different execution plan.As an example, with import_num = '4520440' the execution plan shows Nested Loop and is taking ~12secs. With import_num = '4520460' exec