Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[YSQL] Describing a colocated Materialized View does not show colocation information #17060

Open
1 task done
Rahulbiju315-yb opened this issue Apr 27, 2023 · 0 comments
Open
1 task done
Assignees
Labels
area/ysql Yugabyte SQL (YSQL) kind/bug This issue is a bug priority/medium Medium priority issue

Comments

@Rahulbiju315-yb
Copy link
Contributor

Rahulbiju315-yb commented Apr 27, 2023

Jira Link: DB-6369

Description

Describing a colocated Materialized View (\d materialized_view_name) does not show colocation information. When describing a colocated table a "Colocation: true" row is displayed.

Steps to reproduce:
CREATE DATABASE colodb WITH colocation = true;
\c colodb
CREATE TABLE x (a INT);
CREATE MATERIALIZED VIEW m1 AS SELECT * FROM x;
\d x
\d m1
screenshot

Warning: Please confirm that this issue does not contain any sensitive information

  • I confirm this issue does not contain any sensitive information.
@Rahulbiju315-yb Rahulbiju315-yb added area/ysql Yugabyte SQL (YSQL) status/awaiting-triage Issue awaiting triage labels Apr 27, 2023
@yugabyte-ci yugabyte-ci added kind/bug This issue is a bug priority/medium Medium priority issue labels Apr 27, 2023
@Rahulbiju315-yb Rahulbiju315-yb self-assigned this Apr 27, 2023
@yugabyte-ci yugabyte-ci removed the status/awaiting-triage Issue awaiting triage label Apr 27, 2023
Rahulbiju315-yb added a commit that referenced this issue May 3, 2023
… colocation information

Summary:
We can specify the colocation of a materialized view using the with (colocation = true/false) clause
Eg:
      CREATE MATERIALIZED VIEW m1 with (colocation = true) AS SELECT * from t1;  [Creates colocated Mat. view]
      CREATE MATERIALIZED VIEW m2 with (colocation = false) AS SELECT * from t1; [Creates non-colocated Mat. view]
      CREATE MATERIALIZED VIEW m3 AS SELECT * from t1;                           [Creates colocated Mat. view]
By default colocation is true.

There was an issue with describe that it didnt show colocation info of a materialized view, have fixed that by including Materialized View as a supported relation kind for colocation in add_colocation_footer which is called while preparing result of the \d command

Running \d m1 (where m1 is a colocated Mat. view) before change produces the following output:
           Materialized view "public.m1"
           Column |  Type   | Collation | Nullable | Default
           --------+---------+-----------+----------+---------
           a      | integer |           |         |

This is unlike executing it on a colocated table which produces an extra row "Colocation: true"

After changes the output is:
           Materialized view "public.m1"
           Column |  Type   | Collation | Nullable | Default
           --------+---------+-----------+----------+---------
           a      | integer |          |           |
           Colocation: true

Test Plan:
./yb_build.sh --java-test org.yb.pgsql.TestPgRegressColocation#testPgRegressColocation

Checked tablet-ids of colocated and non-colocated materialized view on yb-ctl cluster

Reviewers: skumar, tverona, yguan, fizaa

Reviewed By: yguan, fizaa

Subscribers: ksreenivasan, yql

Differential Revision: https://phabricator.dev.yugabyte.com/D24206
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ysql Yugabyte SQL (YSQL) kind/bug This issue is a bug priority/medium Medium priority issue
Projects
None yet
Development

No branches or pull requests

2 participants