GitHub user interma opened a pull request:
https://github.com/apache/incubator-hawq/pull/1098
HAWQ-1286. Reduce unnecessary calls of namespace check when run \d
## Backgroud:
After HAWQ-1279 is done, current schema is no cached in current session.
But it cause too many calls of namespace check to send in run \d , most of
them are unnecessary.
## Example
```
\d:
select version()
SELECT n.nspname as \"Schema\",\n c.relname as \"Name\",\n CASE
c.relkind WHEN 'r' THEN 'table' WHEN 'v' THEN 'view' WHEN 'i' THEN 'index' WHEN
'S' THEN 'sequence' WHEN 's' THEN 'special' END as \"Type\",\n
pg_catalog.pg_get_userbyid(c.relowner) as \"Owner\"\nFROM pg_catalog.pg_class
c\n LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace\nWHERE
c.relkind IN ('r','v','S','')\n AND n.nspname <> 'pg_catalog'\n AND
n.nspname <> 'information_schema'\n AND n.nspname !~ '^pg_toast'\n AND
pg_catalog.pg_table_is_visible(c.oid)\nORDER BY 1,2;
recomputeNamespacePath()
recomputeNamespacePath()
.... recompute many times in this long select sql
```
## Solution
Store the last sql query, only recompute if the query is changed.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/interma/interma-hawq HAWQ-1286
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/incubator-hawq/pull/1098.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #1098
----
commit 5da0476a168a754a1c3d55096d6bbb31ecdd78ab
Author: interma <[email protected]>
Date: 2017-01-20T06:46:16Z
HAWQ-1286. Reduce unnecessary calls of namespace check when run \d
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---