﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
36732	Sitemaps with i18n=True fetch the entire queryset of items before paginating	Julien Palard	Augusto Pontes	"Hi!

It's a bit like: https://code.djangoproject.com/ticket/11572

when enabling i18n on a sitemap, _items uses the following code:

{{{
            # Create (item, lang_code) tuples for all items and languages.
            # This is necessary to paginate with all languages already considered.
            items = [
                (item, lang_code)
                for item in self.items()
                for lang_code in self.get_languages_for_item(item)
            ]
}}}

The list comprehension loads the whole table times the number of languages in memory.

We tried with a table containing two millions elements and two languages: it does not fit in 16GB of memory and the process gets killed.
"	Cleanup/optimization	assigned	contrib.sitemaps	5.2	Normal		sitemap, memory	Julien Palard Roxane	Accepted	1	1	1	0	0	0
