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

Cannot use prepared statements when caching disabled #4074

Closed
monetdb-team opened this issue Nov 30, 2020 · 0 comments
Closed

Cannot use prepared statements when caching disabled #4074

monetdb-team opened this issue Nov 30, 2020 · 0 comments
Labels
bug Something isn't working normal SQL

Comments

@monetdb-team
Copy link

Date: 2016-09-23 18:31:01 +0200
From: Richard Hughes <<richard.monetdb>>
To: SQL devs <>
Version: 11.23.7 (Jun2016-SP1)
CC: @njnes

Last updated: 2016-10-13 10:04:18 +0200

Comment 22386

Date: 2016-09-23 18:31:01 +0200
From: Richard Hughes <<richard.monetdb>>

Build is Jun2016 f32bf50af59a

To reproduce:

sql>set cache=0;
sql>prepare select 1;

Expected:
execute prepared statement using: EXEC 3(...)
+---------+--------+-------+--------+-------+--------+
| type | digits | scale | schema | table | column |
+=========+========+=======+========+=======+========+
| tinyint | 8 | 0 | | L | |
+---------+--------+-------+--------+-------+--------+

Actual:
[no output]

This seems to fix it:
diff -r c94cdb95264d sql/backends/monet5/sql_scenario.c
--- a/sql/backends/monet5/sql_scenario.c Thu Sep 15 11:09:35 2016 +0100
+++ b/sql/backends/monet5/sql_scenario.c Fri Sep 23 16:52:35 2016 +0100
@@ -1241,7 +1241,7 @@
SQLsetTrace(be, c, TRUE);
if (m->emod & mod_debug)
SQLsetDebugger(c, m, TRUE);

  •           if (!caching(m) || !cachable(m, s)) {
    
  •           if ((!caching(m) || !cachable(m, s)) && m->emode != m_prepare) {
                      scanner_query_processed(&(m->scanner));
                      if (backend_callinline(be, c, s, 0) == 0) {
                              opt = 1;
    

Background:
As part of my research in to other memory leaks, my eye fell on the space consumed by the query plan cache. I instrumented it a bit and found that the hit rate for our usage was not worth the hundreds of MB occupied by the cache, so have disabled it entirely in some of our clients. We have one query in one client for which plan caching would be useful, so I was trying to use a prepared statement to selectively cache just that one case.

Comment 22390

Date: 2016-09-29 12:48:51 +0200
From: @njnes

added the patch. Thanks for looking so deeply into the code.

Comment 22391

Date: 2016-09-29 12:50:08 +0200
From: MonetDB Mercurial Repository <>

Changeset 4f8d5096c98a made by Niels Nes niels@cwi.nl in the MonetDB repo, refers to this bug.

For complete details, see http//devmonetdborg/hg/MonetDB?cmd=changeset;node=4f8d5096c98a

Changeset description:

even without caching, prepare statements need to be 'cached'.
See bug #4074

Comment 24496

Date: 2016-10-13 10:04:18 +0200
From: @sjoerdmullender

Jun2016-SP2 has been released.

@monetdb-team monetdb-team added bug Something isn't working normal SQL labels Nov 30, 2020
@sjoerdmullender sjoerdmullender added this to the Ancient Release milestone Feb 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working normal SQL
Projects
None yet
Development

No branches or pull requests

2 participants