Re: QB count method
Johan Bernhardsson <[email protected]> Wed, 22 Feb 2006 18:33:00 +0100
| Newsgroups | gmane.comp.web.midgard.devel |
|---|---|
| Message-ID | <[email protected]> |
For your information. If you are using innodb.
Using count() on a mysql database with innodb is very expencive for the
ddatabase if counting large objects.
As innodb doesnt care of the content of a table it HAS to count it every
time.
/Johan "SmallOne" Bernhardsson
On Wed, 2006-02-22 at 18:49 +0200, Henri Bergius wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi!
>
> Is there any way to make this more efficient?
>
> [18:44] bergie: ok, that count_unchecked made it a bit more
> efficient, but I'm not 100% happy with that yet
> [18:45] bergie: one current website project gave me pretty good test
> data... thousands of real world forum posts
> [18:45] torben: bergie: this is as fast as QB can get
> [18:45] torben: count_unchecked relays everything to the core
> [18:45] bergie: as long as it fetches results to make the count, yes
> [18:46] torben: there are a few minor additional checks when calling
> the add_* stuff, but that's it. if it is not fast enough, complain
> with Piotras
> [18:46] bergie: jukka said QB used to have a real count
> implenmentation, too
> [18:46] torben: *i*am*using*that*
> [18:46] torben: for another time:
> [18:46] torben: "This is a mapping to the real count function of the
> Midgard Query Builder. It is mainly intended when speed is important
> over accuracy, as it bypasses access control to get a fast impression
> of how many objects are available in a given query."
> [18:46] torben: "of the real fount function of the Midgard Query
> Builder"
> [18:47] torben: or, in other words:
> [18:47] torben: function count_unchecked()
> [18:47] torben: {
> [18:47] torben: return $this->_qb->count();
> [18:47] torben: }
> [18:47] bergie: now forum front page takes 7 seconds to generate,
> only showing thread titles and post count per thread
> [18:47] bergie: that isn't real SQL count, IMO
> [18:47] bergie: or is it?
> [18:47] torben: i do not know
>
>
> Henri Bergius
> Consultant Partner, Nemein
> henri.bergius-ZpG/[email protected]
>
> Midgard CMS
> www.midgard-project.org
>
>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.1 (Darwin)
>
> iD8DBQFD/JYBNkT8k497k9IRArhCAJ93yMXAY7Cuj/DDQLlyOROXf7rLjQCglAul
> dglUyW93K6+DOfdgu85clyw=
> =wAvd
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe-b5ZhpPVuLA+tlBvVaVFjCkB+6BGkLq7r@public.gmane.org
> For additional commands, e-mail: [email protected]
>
>
--
Johan Bernhardsson
Linux/CMS/Network Consultant
Phone: +46-13-73244
Mobile: +46-705-111751
Fax: +46-13-73190
Email: [email protected]
Web: www.anykey.se
signature.asc
(application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQBD/KBM5oUA6E58WOMRAv2HAJ9EvGgyxjiqank5Sz6ktc3xoZlr8wCeIRGt cJvYI/m0Tyr9c93Uz6R7Hvs= =eCXc -----END PGP SIGNATURE-----