Uploaded image for project: 'Apache NiFi'
  1. Apache NiFi
  2. NIFI-3425

Cache prepared statements in PutCassandraQL

    Details

    • Type: Improvement
    • Status: Patch Available
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      Currently PutCassandraQL supports prepared statements (using ? parameters much like JDBC SQL statements) via flow file attributes specifying the type and value of the parameters.

      However, the prepared statement is created (and thus possibly re-created) for each flow file, which neuters its effectiveness over literal CQL statements. The driver warns of this:

      2017-01-31 14:30:54,287 WARN [cluster1-worker-1] com.datastax.driver.core.Cluster Re-preparing already prepared query insert into test_table (id, timestamp, id1, timestamp1, id
      2, timestamp2, id3, timestamp3, id4, timestamp4, id5, timestamp5, id6, timestamp6) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);. Please note that preparing the same query
      more than once is generally an anti-pattern and will likely affect performance. Consider preparing the statement only once.

      Prepared statements should be cached and reused where possible.

      1. NIFI-3425.patch
        31 kB
        Matt Burgess

        Activity

        Hide
        combine Byunghwa Yun added a comment -

        Matt Burgess
        Could you apply this patch to the main branch?
        Thank you.

        Show
        combine Byunghwa Yun added a comment - Matt Burgess Could you apply this patch to the main branch? Thank you.
        Hide
        mattyb149 Matt Burgess added a comment -

        Attached patch file, contributed by Michael Giroux. Thank you for your contribution!

        Show
        mattyb149 Matt Burgess added a comment - Attached patch file, contributed by Michael Giroux. Thank you for your contribution!

          People

          • Assignee:
            Unassigned
            Reporter:
            mattyb149 Matt Burgess
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:

              Development