Wednesday, December 17, 2014

Re: Any benefit in storing shorter strings or numbers to represent data for a choice char field?

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBCAAGBQJUkdI7AAoJEC0ft5FqUuEhERYP/A2S3VVxMw7Z0L4/nx4NU7lu
6QFEt5c55Cp7M8qAEx8eGoA8GOWJcU3mZZ4HcwFbx8mUTCNVNaKWLv9UCM7Hqiq8
KKZFJ6rq9a3Gp15kCyvk/wr56aINmUM8d9zRQlK6wePjEAgYacf3uhFm4tXEV6z/
vJv/hwgVbPjvnW8WOX6exnYkAq4wts9yuS1kdXpaOUCdw6MoTLbzlkj+dKtAM8gp
Txbsuskbz8Kiw1M3lyW2yos/Kh7E2UN8NBo18iMcRCQ+fYL0Xd9+dFgtxHeoidvX
uDqLAvzHaNTKeQlw8odXF2bAF2Fvp+xHmhwtQm/xGDekCWUTQP+ZeFPEHDHjbiJc
Wj9Cszh8Fz/ez8FRAJi1xLv0OMBLoa8xhYOWLi2QdhzFdW4GR/NvCYdDwKwA15Ki
dSCmSfjliSQL77Dbil8VJKksgWy0rFZl0xvc5onj3GttSwU93X3dkVIBPvX+UsRj
/V6k5kEms15zF2XxlTZn05S37TjXu2B41xNeOX6qYz8RWtZg936uesfUCpRhBOTP
wfsOM9cFxnLNeFYmHJtQ5SJg3GgfpGduEINqKqLgy2OFowAtSksHtB7yjuhormIo
W6E36V5SbsgmM9ZXLuts67GJPM1E+12FFhYzkcDa4nhCpEdKcFg8HsSVBB0/nQDe
eA0UiaLtPpWg35F5mDd3
=au1b
-----END PGP SIGNATURE-----
On 12/17/2014 11:52 AM, Radomir Wojcik wrote:
>
> So to answer my own question, you wouldn't use the short version in the db if you plan to do like/contains queries on them. Correct me if I'm wrong.

True. I don't think I've ever seen a case where a field had choices and
I also wanted to do like/contains queries on it. If a field has choices
set, it's likely that a more useful way to let a user search on that
field would be a fixed-choices filter rather than a keyword search.

> Unless I plan to use haystack later and index the human readable form
> later. I think I understand now, thanks

Right, the exception to the above would be when the value of this field
is just one field feeding into a larger keyword search on the whole
object -- and in that case I wouldn't ever do like/contains on the
original field, I'd feed its human readable form into a full text search
engine.

Carl

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5491D23B.1050502%40oddbird.net.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment