Re: Horde_Db best practices question
Ralf Lang <[email protected]> Wed, 15 Nov 2017 08:29:16 +0100
| Newsgroups | gmane.comp.horde.devel |
|---|---|
| Message-ID | <[email protected]> |
Am 13.11.2017 um 09:41 schrieb Sebastian Birnbach: > I have an application that manages dossiers to which users can add > comments, much like user comments to a Whups ticket. I expect the number of > dossiers to grow into the 10.000s over the years and every dossier may > comprise up to a hundred comments. > > The backend db is a mySQL. > > One way to manage the comments would be to add each one into a big table > and include a reference to the dossier object. Lookup speed would degrade > with the number of comments in the table, though. Approaching the design > limit, selecting comments out of a million may be quite slow. It should not - use an int primary key for dossier id use an int primary key for comment id have an index on dossier_id in the comment table If this isn't fast enough, go for the database's native options. Mysql/MariaDB support partitioning of data. For example, partition by hashes of dossier IDs. However, don't overdo. Getting 100 out of 1.000.000 columns by an appropriate index is not much for mysql, properly sized and configured. > > Another way would be to create a dedicated comments table for each record. > Selecting comments for a dossier would probably be much faster but all the > tables would also clutter table space. Plus I don't see a pre-fabricated > way to do this in the Horde framework and there is no example in the > existing applications either. You would need to use horde_db's schema modifying functions in live code. Better don't. If you ever need a schema upgrade, it will become quite complicated. Regards Ralf -- Ralf Lang Linux Consultant / Developer Tel.: +49-170-6381563 Mail: [email protected] B1 Systems GmbH Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537 -- dev mailing list Frequently Asked Questions: http://wiki.horde.org/FAQ To unsubscribe, mail: [email protected]
signature.asc
(application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEBpT8EQ/L1q0Lw7OKetjCgaxv67MFAloL7NIACgkQetjCgaxv 67NNag//X//28GXnwWaA7iAMDa+nzg70jSHCDpbyGPNo5I7l/NUT984qurgX74S+ yYRBMVvMRsmunR6gYUJZLfjBh9E92mZlI+pM1TdQdHi0s0qNIdRM25I4J4Nvp2/i 4gIWaqsAimYoEZR42//Cj0cPkKFhxigXZ2FvaxxF41dVUPQCRsG8bZ10VvyJSPHB AjgIJq/I7L9G1dzLS1yS9XNOjJCai7DRzoQnZ5jhAsamGdCKePiebSMplfOacDj9 05sswFApAb7h8E1UM0gHd1GyBogh6h3BwnmVS401jVFLsyLWSrDW9JdQifF5HhoR 5/8zjMB8l4AznjCrAmeIrecj2rcbd7/pR3pz6bIE47vZ7jAUTJOvq7tussJ1NXSg glZAeQCnUr/ZZRrrQ8A9n4eFh92hybUurh2MYB6lSeurm76DnAimkFPvUTD/B6VO yyRTV9A4q0SJPQQ3mRM0/9avA8D9QNTMr5ILA1TGdVbfMuxZLqgOF6x00OrRlMZd e70SRU77ok0Q8RdDKbfVyVmaR4bn5YJQQMZvtNoumfQip4hBuEG3L8Y881g0oPSE bR+cI5kTWHg8TSOh8MxKmuIudxSgFZQAWhU4s/9tRNGv+E6ld1Wg1yXHw5xjtot3 pPwSd+z9Qrm7woCfEjPg+ctMS99c9bO33nrtwz9uo3rOq8C52NE= =jRdR -----END PGP SIGNATURE-----