Preparing statement basically lets the server optimize for the structure of
a given query. So for example, say you want to Insert a lot of rows to a
table with columns a, b, c.

You may prepare a statement
*Insert into fun_table (a,b,c) values (?,?,?)*

The question marks are basically slots for variables to be sent by the
client. So the server basically has the assert ready to go, it just needs
to get those variables.
Now, on the client when you bind values into that prepared statement, you
basically just make a tiny package which just those row values and the
identifier for
the prepared statement.

So each time you send a row now instead of sending the entire statement you
send a tiny efficient bit of data, and the server is ready to handle it the
moment it arrives.

This makes the pattern of

Prepare Statement
for (data in all the data)
   execute_async(prepared_staement.bind(data))

Very efficient

On Fri, Dec 13, 2019 at 3:42 AM lampahome <pahome.c...@mirlab.org> wrote:

> I use cassandra-python driver and try to be familiar with
> preparedstatement to improve performance.
>
> I saw doc on datastax about it, but it doesn't describe detaily.
>
> Can anyone explain what does it prepare what? Will that help performance?
>
> thx
>

Reply via email to