Hello Igor,

this is not the complete query - only the part which causes the problem. 
The complete query is:
SELECT DISTINCT interfaces_int_id,device_dev_id FROM devInterface 
INNER JOIN interfaces ON devInterface.interfaces_int_id=interfaces.intf_id 
INNER JOIN nlink ON nlink.interfaces_intf_id=interfaces.intf_id 
INNER JOIN neighbor ON neighbor.neighbor_id=nlink.neighbor_neighbor_id 
WHERE neighbor.l2_addr IN ( 
SELECT macAddress FROM interfaces 
INNER JOIN devInterface ON devInterface.interfaces_int_id=interfaces.intf_id

INNER JOIN device ON device.dev_id=devInterface.device_dev_id 
WHERE devInterface.device_dev_id=1 AND interfaces.l2l3 LIKE 'L2' AND
device.hwtype=2)

But when removing the 2nd part, the query time is the same. The second part
itself is very fast.

Regards,
Mathias

-----Ursprüngliche Nachricht-----
Von: sqlite-users-boun...@sqlite.org
[mailto:sqlite-users-boun...@sqlite.org] Im Auftrag von Igor Tandetnik
Gesendet: Montag, 18. April 2011 15:55
An: sqlite-users@sqlite.org
Betreff: Re: [sqlite] Performance issues with sqlite3 sqlite3_step function

Mathias Spoerr <math...@spoerr.org> wrote:
> I have problems with a specific query when using the "sqlite3_step"
> function:
> 
>    SELECT DISTINCT interfaces_int_id,device_dev_id FROM devInterface
> 
>    INNER JOIN interfaces ON
> devInterface.interfaces_int_id=interfaces.intf_id
> 
>    INNER JOIN nlink ON nlink.interfaces_intf_id=interfaces.intf_id
> 
>    INNER JOIN neighbor ON neighbor.neighbor_id=nlink.neighbor_neighbor_id

Why are you joining with all these tables, when the two fields you want to
select both belong to devInterface? Why not simply

SELECT DISTINCT interfaces_int_id,device_dev_id FROM devInterface;

-- 
Igor Tandetnik

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to