On 2 March 2012 16:23, Duquette, William H (318K) <[email protected]> wrote: > Howdy! > > Suppose I have two related tables, t1 and t2, and I write a view like this: > > CREATE VIEW myview AS SELECT * FROM t1 JOIN t2 USING (some_column); > > If I am querying data just from t1, is there a performance penalty for using > myview in the query? Or will the query planner generate approximately the > same bytecode as it would if I'd simply queried t1? > > -- > Will Duquette -- [email protected]
SQLite version 3.6.11 Enter ".help" for instructions sqlite> create table t1( id integer primary key, data text ); sqlite> create table t2( id integer primary key, data text ); sqlite> sqlite> create view v1 as select t1.id as id, t1.data as d1, t2.data as d2 from t1 join t2 on t1.id=t2.id; sqlite> sqlite> sqlite> explain query plan select data from t1 where id>10; 0|0|TABLE t1 USING PRIMARY KEY sqlite> explain query plan select d1 from v1 where id>10; 0|0|TABLE t1 USING PRIMARY KEY 1|1|TABLE t2 USING PRIMARY KEY sqlite> It seems not for v 3.6.11 Regards, Simon _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

