Re: [gnome-db] Multi column indexes.



On Tue, 2005-02-01 at 11:39 +0100, Vivien Malerba wrote:
> On Tue, 01 Feb 2005 20:22:53 +1000, Bas Driessen <bas driessen xobas com> wrote:

> > 
> > Please respond. If you have other/better ideas/suggestions or if you
> > think some basics are missing, let me know.
> > 
> 
> I was wondering if we could add a method to the GdaDataModel to allow
> for efficient retreival of a row given one or more GdaValues using the
> index structure you just described.
> 
> Let me explain: I have a GdaDataModel (for example the result of a
> "SELECT * from table"), and I need to find the row corresponding to a
> specific value of the primary key of that table. At the moment, I need
> to parse all the rows of the data model and see if each row is the one
> I'm looking for.
> 
> We could have a 
> GdaRow *gda_data_model_locate_row (GdaDataModel *model,
> GdaDataModelIndex *index, GList *values)
> which would locate the correct row in @model using @index and for the
> GdaValues in @values.
> 
> This method could then be implemented by each data model class for
> better performances, and there could be a default fallback to the
> complete data model parsing if that particular method has not been
> implemented for a data model.
> 
> What do you think? Do you think the GdaDataModelIndex structure as it
> is now could be used for that purpose?

You can definitely use the layout of the GdaDataModelIndex for it, since
it contains all the values you need, but from a technical point of view
an internal index on a datamodel may be a bit complex to build. When we
create the data model (after select * from table) for instance, we then
not only need to store "just" the data entries, but also need to know
the available indexes and create internal index representations. So how
would that work? 

Maybe we should go a step back first by asking if we really need that. I
mean if the data model is too big, maybe the SQL query was not complete
enough to begin with. On the other hand if you have 1000 entries in your
data model and want to know details of a specific record, why not issue
a separate SQL statement targeting that record in parallel?

Don't get me wrong Vivien, I am not knocking your idea at all, on the
contrary, good performance is essential to have, but I am just thinking
outloud why we would build our own "database" type of system to manage
datamodels while SQL etc is all ready out there to be used. Perhaps I
just need to give it a bit more thought.

Bas.



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