Giter Club home page Giter Club logo

Comments (8)

TimonKK avatar TimonKK commented on August 15, 2024 1

You need parallel query with own session? Or you need pass some specific session_id in each query?

from clickhouse.

sarthaksahni avatar sarthaksahni commented on August 15, 2024

You need parallel query with own session --- This is not possible by the design of ClickHouse. If it is I would love to know.

you need pass some specific session_id in each query? -- YES! Exactly!

from clickhouse.

sarthaksahni avatar sarthaksahni commented on August 15, 2024

added a PR #52 for the same as well. Please let me know if I am doing something fundamentally wrong here.

from clickhouse.

sarthaksahni avatar sarthaksahni commented on August 15, 2024

Just checked the test are added by you at line 300, thanks for looking into the issue however this is not what I meant, as we all know in JS most of the variables are referred apart from numbers and some other.. so the issue is that the same ClickHouse connection is used across multiple routes and connections and requests that are served by the http server at node as well! Now due to same session name the queries will get locked!

But I am sure this was taken care and random sessions are created, however this defeats the purpose of creating a temporary table and serving user the data from this temporary table to prevent further querying the main table over which we won't like to put stress on!

Use Case
I have a complex query that consumes a lot of time, and I simply create a session for one of my user and provide a session id such as sess_${userId} now when this user queries I would use this session_id to access the temporary table I built for this specific user in the specific session.

This can enable people using this driver to create destroy and persist session as per the requirement.

(PS: I upgraded from 19.6 to 20.3 as I got to know about fixed session locking issues, but they still persist, concurrent HTTP calls lock session. I am shifting my code base to build actual memory engine tables and then destroying them over the time by analysing system.tables, hope our discussion helps someone else.)

from clickhouse.

TimonKK avatar TimonKK commented on August 15, 2024

Do you mean interface like this:

// init
const clickhouse = new ClickHouse(...);

// route
const userCH = clickhouse.getSession();
const rows = await userCH.quiery...
const rows2 = await userCH.query...
?

from clickhouse.

sarthaksahni avatar sarthaksahni commented on August 15, 2024

Possibly yes, that's another way to put it, in short isolating one request and session name. However, if User A sends me a request, I would like to create a session as session_user_a and for User B I would create sess_user_b and ensure they don't lock each other out at any point in time.

from clickhouse.

TimonKK avatar TimonKK commented on August 15, 2024

I published version with your MR

from clickhouse.

sarthaksahni avatar sarthaksahni commented on August 15, 2024

Thanks a ton!

from clickhouse.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.