[Qgis-developer] QEP/RFC sqlite virtual tables

Martin Dobias wonder.sk at gmail.com
Fri Nov 7 22:06:46 PST 2014


Hi Hugo

On Tue, Nov 4, 2014 at 8:36 PM, Hugo Mercier <hugo.mercier at oslandia.com> wrote:
>
> * About indexes on virtual tables, contrary to what I wrote previously,
> the xBestIndex() method of virtual tables should be enough to orient the
> planner, an estimated cost and estimated number of rows can be returned
> for each part of the where clause. So there should be no need to copy
> native indexes.
> But the provider interface should be extended in order to provide such
> statistics.

I am trying to figure out how the things would work...

How would you decide whether to copy native index of a virtual table?
(Always?) E.g. pkey at least in Postgres is also index - shall we
always copy it?
When would you make copies of native indexes? (When constructing the
provider? On every getFeatures() call?)
How would you keep the index up to date? (Table may change outside of QGIS)

What I want to understand is how SQL select statements would execute -
like the one with join filter you need:

SELECT * FROM tblA LEFT JOIN tblB ON tblA.X = tblB.Y WHERE tblY.Z = 42


> We are willing to develop this as a plugin if it can be included in QGIS
> as a c++ plugin. Is there any objection to this ?

Personally I do not see much difference in having some functionality
in 'core' and having some functionality in c++ plugin (included in
QGIS tree) - in both cases that requires us to maintain such code once
it is added...

Why not develop a prototype that does not require QGIS code - I guess
the only QGIS-specific part is the virtual table implementation. Such
prototype could eventually evolve to a standalone library providing
SQL parser / execute engine with a nice interface...


Cheers
Martin


More information about the Qgis-developer mailing list