Tuesday, January 8, 2019

Re: queries and date ordering

On 9/01/2019 4:29 pm, Dylan Reinhold wrote:
> No you can't rely on it being the same order, if the database is
> re-indexed or reorged that order might change.

Thanks

>
> On Tue, Jan 8, 2019 at 9:18 PM Mike Dewhirst <miked@dewhirst.com.au
> <mailto:miked@dewhirst.com.au>> wrote:
>
> If I have a model with ...
>
>      created = models.DateTimeField(auto_now_add=True)
>
> ... and in class Meta
>          ordering = ['-created']
>
> Is it true that with multiple records where the query search
> params are
> identical the first record returned by the query will always be
> the most
> recent?
>
> Postgres
>
> Thanks
>
> Mike
>
> --
> 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
> <mailto:django-users%2Bunsubscribe@googlegroups.com>.
> To post to this group, send email to django-users@googlegroups.com
> <mailto:django-users@googlegroups.com>.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/6e8deada-5376-7865-8531-6aaf59c6d0e6%40dewhirst.com.au.
> For more options, visit https://groups.google.com/d/optout.
>
> --
> 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
> <mailto:django-users+unsubscribe@googlegroups.com>.
> To post to this group, send email to django-users@googlegroups.com
> <mailto:django-users@googlegroups.com>.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAHtg44A%3DDULMew1w%2BCCjRFepY5TD9bYWTSWzhRtnRxWy-Vn71Q%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAHtg44A%3DDULMew1w%2BCCjRFepY5TD9bYWTSWzhRtnRxWy-Vn71Q%40mail.gmail.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.

--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/60ac017f-3490-6998-1370-35a47929b7fc%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment