You’re right Gunter. I think it’s been pointed out to me before as well. Doh.



________________________________
From: sqlite-users <sqlite-users-boun...@mailinglists.sqlite.org> on behalf of 
Hick Gunter <h...@scigames.at>
Sent: Thursday, March 15, 2018 10:32:20 AM
To: 'SQLite mailing list'
Subject: Re: [sqlite] [EXTERNAL] count optimisation

The statement "select count() from <table>" is optimized to retrieve the count 
without visiting each row. This is well documented behaviour.

-----Ursprüngliche Nachricht-----
Von: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] Im 
Auftrag von x
Gesendet: Donnerstag, 15. März 2018 11:20
An: sqlite-users@mailinglists.sqlite.org
Betreff: [EXTERNAL] [sqlite] count optimisation

select count(*) from TblA cross join TblB

is over 200 times slower than

select (select count(*) from TblA) * (select count(*) from TblB);

Not that it matters to me. I came across it by accident and mention it only in 
case it’s a missed optimisation.

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


___________________________________________
 Gunter Hick | Software Engineer | Scientific Games International GmbH | 
Klitschgasse 2-4, A-1130 Vienna | FN 157284 a, HG Wien, DVR: 0430013 | (O) +43 
1 80100 - 0

May be privileged. May be confidential. Please delete if not the addressee.
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to