Re: Slow tab completion w/ lots of tables

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Stephen Frost <sfrost(at)snowman(dot)net>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Slow tab completion w/ lots of tables
Date: 2012-08-21 17:11:11
Message-ID: 4174.1345569071@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Stephen Frost <sfrost(at)snowman(dot)net> writes:
> * Stephen Frost (sfrost(at)snowman(dot)net) wrote:
>>> Is this a regression versus earlier releases, or just a bad thing in general?

>> It's really a regression- in prior releases

> Sorry, to clarify (after reading through my -hackers inbox a bit more
> and realizing you were probably asking about 9.2)- it's a regression,
> but it was also in earlier releases.. I'd have to go back to the git
> blame that I ran earlier to find it, but I think the change was made
> in 8.4 or 9.0, so I don't think it's a regression as far as
> 9.0 -> 9.1 or 9.1 -> 9.2 is concerned.

> I'm slightly ashamed to admit that we discovered it during our migration
> from 8.2 -> 9.1...

Um ... I don't see any difference in the clause ordering from 8.2
forward. "SELECT * FROM baz<TAB>" produces a query like this in 8.2:

LOG: statement: SELECT pg_catalog.quote_ident(c.relname) FROM pg_catalog.pg_class c WHERE c.relkind IN ('r', 'S', 'v') AND substring(pg_catalog.quote_ident(c.relname),1,3)='baz' AND pg_catalog.pg_table_is_visible(c.oid) AND c.relnamespace <> (SELECT oid FROM pg_catalog.pg_namespace WHERE nspname = 'pg_catalog')
UNION
SELECT pg_catalog.quote_ident(n.nspname) || '.' FROM pg_catalog.pg_namespace n WHERE substring(pg_catalog.quote_ident(n.nspname) || '.',1,3)='baz' AND (SELECT pg_catalog.count(*) FROM pg_catalog.pg_namespace WHERE substring(pg_catalog.quote_ident(nspname) || '.',1,3) = substring('baz',1,pg_catalog.length(pg_catalog.quote_ident(nspname))+1)) > 1
UNION
SELECT pg_catalog.quote_ident(n.nspname) || '.' || pg_catalog.quote_ident(c.relname) FROM pg_catalog.pg_class c, pg_catalog.pg_namespace n WHERE c.relnamespace = n.oid AND c.relkind IN ('r', 'S', 'v') AND substring(pg_catalog.quote_ident(n.nspname) || '.' || pg_catalog.quote_ident(c.relname),1,3)='baz' AND substring(pg_catalog.quote_ident(n.nspname) || '.',1,3) = substring('baz',1,pg_catalog.length(pg_catalog.quote_ident(n.nspname))+1) AND (SELECT pg_catalog.count(*) FROM pg_catalog.pg_namespace WHERE substring(pg_catalog.quote_ident(nspname) || '.',1,3) = substring('baz',1,pg_catalog.length(pg_catalog.quote_ident(nspname))+1)) = 1
LIMIT 1000

and the only difference in HEAD is another relkind in the IN clauses.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2012-08-21 17:20:24 Re: Slow tab completion w/ lots of tables
Previous Message Josh Berkus 2012-08-21 17:07:16 Re: PostgreSQL 9.2beta4 (& git HEAD) server crash on creating extension plpython3u