phoenix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shubham (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (PHOENIX-4725) Hint part in a query does not take into account the "schema" which is passed in the JDBC connection string
Date Tue, 29 May 2018 20:08:00 GMT

    [ https://issues.apache.org/jira/browse/PHOENIX-4725?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16494176#comment-16494176
] 

Shubham commented on PHOENIX-4725:
----------------------------------

In mysql as well, query is able to use INDEX from HINT with tablename as parameter without
schema name in it.

 
{code:java}
Connection url : jdbc:mysql://host:3306/testDB

Queries:

CREATE TABLE customers
( customer_id varchar(10) NOT NULL,
  customer_name varchar(50) NOT NULL,
  city varchar(50),
  PRIMARY KEY (customer_id)
);


insert into customers values (1,'cust1', 'CF');
insert into customers values (2,'cust2', 'CF1');
insert into customers values (3,'cust3', 'CF2');

create index customers_idx on customers (city);

 

Explain Plan:

mysql> explain SELECT /*+ INDEX_DESC(customers customers_idx) */ *
    ->   FROM customers where city = 'CF';
+----+-------------+-----------+------+---------------+---------------+---------+-------+------+-------------+
| id | select_type | table     | type | possible_keys | key           | key_len
| ref   | rows | Extra       |
+----+-------------+-----------+------+---------------+---------------+---------+-------+------+-------------+
|  1 | SIMPLE      | customers | ref  | customers_idx | customers_idx | 53     
| const |    1 | Using where |
+----+-------------+-----------+------+---------------+---------------+---------+-------+------+-------------+
1 row in set (0.00 sec)

 

{code}

> Hint part in a query does not take into account the "schema" which is passed in the JDBC
connection string
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: PHOENIX-4725
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-4725
>             Project: Phoenix
>          Issue Type: Bug
>    Affects Versions: 4.7.0
>            Reporter: Pulkit Bhardwaj
>            Assignee: Shubham
>            Priority: Major
>
> If I connect to hbase via phoenix using a jdbc connection and specify the schema name
in the connection, I would be able to do use the table names without having to specify the
schema name in the query
> e.g
> {code:java}
> SELECT * from SCHEMA_NAME.TABLE_NAME{code}
> can we written as
> {code:java}
> SELECT * from TABLE_NAME{code}
> but
>  let's say I want to pass a hint to use a particular index on the table
> {code:java}
> SELECT /*+ INDEX(SCHEMA_NAME.TABLE_NAME IDX_TABLE) */ * from TABLE_NAME{code}
> the above works, but if I remove the SCHEMA_NAME from inside the hint part, the query
would not reconise the index
>  in other words, the below would not work
> {code:java}
> SELECT /*+ INDEX(TABLE_NAME IDX_TABLE) */ * from TABLE_NAME{code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message