Re: [gnome-db] libgda performance issues



On 6/23/07, Piotr Pokora <piotrek pokora gmail com> wrote:
"Vivien Malerba" <vmalerba gmail com> wrote:

> > I think I do not follow.
> > Do you mean I can invoke gda_connection_execute_select_command with
> > GdaParameterList ?
>
> Yes, you can pass a GdaParameterList object to the
> gda_connection_execute_select_command() function, see the
> documentation about it for what named parameters it can contain.

I try to read docs and source code, and do not get params idea.
For MySQL provider params argument is just passed from one method to
another. At the end ( when MySQL provider execute_command is invoked)
these param argument is just ignored.
gda_mysql_provider_execute_command just ignores ( doesn't use ) it at all.

This API is relatively new and not all the providers take into account
the parameters. I've just recently implemented that support for
postgres which means that you can request a cursor-based-only data
model or a random access data model (differences will be on the memory
consumed, probably not much on the performances, but it depends on
what you do with the data).


I made another tests with GdaDataModel:

GdaDataModel *get_a_model (GdaConnection *cnc, const gchar *sql)
{
        GdaDict *dict = gda_dict_new();
        gda_dict_set_connection(dict, cnc);

        GdaQuery *gdaquery =
                gda_query_new_from_sql(dict, sql, NULL);

        GdaDataModel *_model =  gda_data_model_query_new(gdaquery);

        g_object_unref(dict);
        g_object_unref(gdaquery);

        return _model;
}

GdaDataModel *get_b_model (GdaConnection *cnc, const gchar *sql)
{
        GdaCommand *command;
        command = gda_command_new (sql,
                        GDA_COMMAND_TYPE_SQL,
                        GDA_COMMAND_OPTION_STOP_ON_ERRORS);

        GdaDataModel *model =
                gda_connection_execute_select_command(
                                cnc,
                                command, NULL, NULL);
        gda_command_free(command);
}

Both methods are valid, but using the first method will give you a
data model which may be updatable (that is you can add/modify/remove
rows and the database will be modified) whereas the 2nd method will
not give you a modifiable data model (with a few exceptions of some
provider's implementations)


get_a_model seems to be twice faster than get_b_model.

Very strange considering that it does _much_ more work...


*But* bottleneck seems to be interesting ( get_a_model ).

Time: 0,0360238552094.

Add:
gda_data_model_get_n_rows(_model);
gda_data_model_get_n_columns(_model);

Time: 0,11718416214

Time is almost the same when I get only n_columns.

Results with get_b_model:

Time: 0.0784959793091
Time: 0.082288980484 /* with get_n_column */

I'd be more at ease if you'd get numbers around the minute instead of
around the 1/100 second because there might be several perturbating
factors there.


Should I use different than GdaDataModel approach?

The fastest method _should_ always be the method B.

Vivien



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]