Phoenix JDBC query - Joins does not work - apache-phoenix

Hello Phoenix Team and friends working on Phoenix/Hbase,
I am connecting to Phoenix layer on HBase using JDBC Driver. My PreparedStatement with simple select query works/executes fine in my Java program. However, when I use any sql join (left, or inner) the PreparedStatement execute query gives below expection even thought I limit my results to 1 or 5 records.
java.sql.SQLException: Encountered exception in sub plan [0] execution.
However when I run the same query (Simple or Joins) works well on Phoenix client.
Did anyone face this issue?
Please share if any fix around
Best regards,
Nandu

Please use the hint /*+ NO_STAR_JOIN */ to execute your query. There are some more hints which can help you to fine tune your query based on the nature of operation which you want to perform.Please refer to hints at this link https://phoenix.apache.org/language/index.html

Related

Getting an unexplained error from a simple SQL query in Oracle NoSQL Database cloud service

Here's a super basic question. I am trying to get the total row count for my table. I tried the following super simple query:
Select count(*) from myTable
in Oracle NoSQL Database cloud service console and also the OCI CLI.
But, I am getting the following error:
QUERY: Illegal Argument: Error: at (1, 7) Could not find function with name COUNT and arity 1
What am I missing?
Currently, the NoSQL console uses the simple REST interface to Oracle NoSQL, which does not support ordering results or aggregate queries. If you're looking for a more capable UI that supports odrdered results and aggregates, you may want to give the IntelliJ plugin a try https://plugins.jetbrains.com/plugin/13052-oracle-nosql-database-connector.
If you're writing code then you'll find that the driver for the cloud service supports ordered results as well as aggregates.

Will Orientdb get a slow query log?

Are there plans to implement a slow query log in ODB?
The explain command is nice, but before I can find out issues with queries with the explain command, I need to know which queries need optimizing.
Or is there some other way of getting slow queries out of a running ODB system?
Scott
You can do it with profiler. It is available only with enterprise edition.

Pgpool prints "unable to parse query" to certain more complex queries

I'm using one pgpool server and 2 RDS servers in load-balance master-slave mode.
It's all going well but I have this one problem i can't find a solution.
I have one query that does only SELECTs with a some joins and etc. However, when I execute this query and then look in pgpool log, it prints the message : " Unable to parse the query:". The query then is executed in the backend 0 (master) with no problem.
Thing is, This is a heavy query and i want it to be balanced as well.
The query has : "INNER JOIN; INNER JOIN LATERAL; COUNT(); GROUP BY; COALESCE(); MAX(); EXTRACT(); EPOCH(); NOW()"
Searching I did only find questions, but no solution at all. Hope any of you guys can help me. Thanks
By taking a look at the LATERAL JOIN (Table Expressions). It's only available after Postgresql 9.3. So maybe you're using an older pgpool version. That's why pgpool can't parse your query.

Mongodb access through sql like syntax

Is there any library where i can access mongodb by using sql like syntax.
Example
use db
select * from table1
insert into table1 values (a,b,c)
delete from table
select a,b,count(*) from table1 group by a,b
select a.field1,b.field2 from a,b where a.id=b.id
Thanks
Raman
The learning curve is small only if you are only doing extremely simple sql queries. If the extent of your SQL querying is "select * from X", then MongoDB looks like a brilliant idea to cut through all the too-complicated SQL. But if you need to perform left outer joins, test for null, check for ranges, subselects, grouping and summation, then you will soon end up with a round concave dent in your desk after being moved to Mongo. The sick punchline is that half the time, the thing you are trying to do can't be done in the Mongo interface. Mongo represents a bold new world where instead of databases doing things like aggregation and query optimization, it just stores data and all the magic is done by retrieving everything, slowly, storing it in app memory, and doing all that stuff in code instead.
YES!
A company called UnityJDBC makes a JDBC driver for mongodb. Unlike the mongo java driver, this JDBC driver allows you to run SQL queries against MongoDB and the driver is supported by any Java appliaction that uses JDBC.
to download this driver go to...
http://www.unityjdbc.com/mongojdbc/mongo_jdbc.php
Its free to download too!
hope this helps
MoSQL might satisfy your needs. It'll require you to run a new PostgreSQL instance but from there you can query your entire Mongo dataset with SQL.
"MoSQL imports the contents of your MongoDB database cluster into a PostgreSQL instance, using an oplog tailer to keep the SQL mirror live up-to-date. This lets you run production services against a MongoDB database, and then run offline analytics or reporting using the full power of SQL."
Have a look at this recent project: http://www.mongosql.com/. I've been looking at it over the last few weeks and it looks very promising.
For those of you who have questioned the usefulness of SQL against MongoDB, consider the large number of not-very-technical users in many organizations, like business analysts, who may know SQL, but don't want to make the leap to JavaScript and JSON. Tools like mongoSQL can help push the adoption of MongoDB in an organization.
There are a few solutions out there, but nearly all of them fail to truly represent the MongoDB data model in a way that the "relationally" minded ODBC/JDBC applications and users desire/require. A recent commercial product was released that addresses these challenges
ODBC:
http://www.progress.com/products/datadirect-connect/odbc-drivers/data-sources/mongodb
JDBC:
http://www.progress.com/products/datadirect-connect/jdbc-drivers/data-sources/mongodb
To address the need for ODBC/JDBC (SQL) access...While there are strong arguments for writing new applications using Mongo's clients, there is still a strong need in the marketplace for quality ODBC/JDBC and SQL based access to MongoDB. This need largely arises from all the reporting, analytic, and BI applications that rely on ODBC/JDBC connectivity and do not offer native integration with MongoDB.
Free NoSQL Viewer supports conversion of SQL queries to MongoDB shell syntax. Furthermore, in SQL Viewer you can even use SQL SELECT statements to query MongoDB collections data without knowing MongoDB query syntax. Check out NoSQL Viewer here www.spviewer.com/nosqlviewer.html
Mongodb and its current driver do not support direct SQL like syntax.
However, all operations are easily doable with the driver specific operations.
Here is a brief mapping of mongodb operations to corresponding SQL like query :
http://www.mongodb.org/display/DOCS/SQL+to+Mongo+Mapping+Chart
There are a couple projects underway to emulate a SQL interface for MongoDB. While they provide a familiar interface, in general they should be avoided. They operate on a fundamentally flawed premise in that they parse strings and translate them into method calls.
Once you work with MongoDB you will find the approach of using classes and methods a much more accessible interface as it works exactly like all other parts of your application. Yes there is a small learning curve as you first start, but for the most part, the interface in MongoDB works how you would expect it to.

EntityManager's named query are slow where as JPAEntityManager's Expression query are faster

I am using Weblogic 10.3 and EJB3 with TopLinks(EclipseLinks) JPA implementation. I am facing an issue with my named queries, which are performing slow. However If I use EclipseLinks JPAEntityManager's Expression query to achieve same, its faster. I am not able to understand why my standard JPA named queries are slow. Has anyone faced similiar issue or Can someone explain the root cause of this issue.
Am I missing any basic tunning or parameter???
That is very odd. Named queries should be in general faster as they are parsed once.
What is the specific query and its SQL? Are you comparing it to the same Expression query, or something different, which is its SQL?
Try enabling the EclipseLink PerformanceProfiler on the queries, or try using a Java profiler such as JProfiler.