Why query `system.jdbc.columns` so slow.
See original GitHub issueenv
- presto 0.210
- jdk1.8
- dbeaver 5.2.4
- DataGrip 2018.2.4
dbeaver
When query from a ‘new’ table - hasn’t been queried in current connection - say
select * from t_sales_bill
or select bill_id from t_sales_bill
it will automatically run the sql below to query all columns in t_sales_bill
table AND SO SLOW(cost 36s)!! It happen whenever you query from a ‘new’ table and so wasting time!
SELECT TABLE_CAT, TABLE_SCHEM, TABLE_NAME, COLUMN_NAME, DATA_TYPE,
TYPE_NAME, COLUMN_SIZE, BUFFER_LENGTH, DECIMAL_DIGITS, NUM_PREC_RADIX,
NULLABLE, REMARKS, COLUMN_DEF, SQL_DATA_TYPE, SQL_DATETIME_SUB,
CHAR_OCTET_LENGTH, ORDINAL_POSITION, IS_NULLABLE,
SCOPE_CATALOG, SCOPE_SCHEMA, SCOPE_TABLE,
SOURCE_DATA_TYPE, IS_AUTOINCREMENT, IS_GENERATEDCOLUMN
FROM system.jdbc.columns
WHERE TABLE_CAT = 'platform_data' AND TABLE_SCHEM LIKE 'platform_data' ESCAPE '\' AND TABLE_NAME LIKE 't_sales_bill' ESCAPE '\' AND COLUMN_NAME LIKE '%' ESCAPE '\'
ORDER BY TABLE_CAT, TABLE_SCHEM, TABLE_NAME, ORDINAL_POSITION
DataGrip
DataGrip has the same problem like dbeaver but not so bad but BAD.
DataGrip will query the whole metadata in system.jdbc
when connection started.
So, it’s like ‘once for all’ not when you need it. BUT it took 55s to query system.jdbc.columns
!
SO
- Why query
system.jdbc.columns
so slow? - Any better database tools for presto?
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Extremely slow JDBC query - java - Stack Overflow
I have a JDBC query that runs 8-20x slower than the same query in Python (using cx_Oracle). I would expect some normal %...
Read more >sql server - Query is slow with JDBC parameters, fast with ...
I discovered that if I take out the use of JDBC parameters and just concatenate the values into the SQL string, it runs...
Read more >Using Presto Jdbc driver results with bad queries while ...
Using Presto Jdbc driver results with bad queries while refreshing schema ... What is the expected result? ... FROM system.jdbc.columns
Read more >Performance tips for the native JDBC driver - IBM
Avoiding SELECT * SQL queries Even if your application never uses a particular column, the JDBC driver has to be made aware of...
Read more >JDBC Driver Application Performance Optimization Tutorial
Because database metadata methods that generate ResultSet objects are slow compared to other JDBC methods, their frequent use can impair system performance. The ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It looks like your query is slow because
dbeaver
has a bug. This is very typical bug.Please take a look at the query:
And specifically predicates:
TABLE_SCHEM LIKE 'platform_data' ESCAPE '\'
andTABLE_NAME LIKE 't_sales_bill' ESCAPE '\'
. Notice that your object names contains_
, in pattern forLIKE
operator_
means any character and in your case it should be escaped. These predicates should look like:TABLE_SCHEM LIKE 'platform\_data' ESCAPE '\'
andTABLE_NAME LIKE 't\_sales\_bill' ESCAPE '\'
.Can you please rerun your query but with properly escaped
LIKE
patterns literals? That would be:Let me close this in favor of https://github.com/dbeaver/dbeaver/issues/4587