Re: Really really slow select count(*)
От | Shaun Thomas |
---|---|
Тема | Re: Really really slow select count(*) |
Дата | |
Msg-id | 4D4C63A4.6090109@peak6.com обсуждение исходный текст |
Ответ на | Re: Really really slow select count(*) (felix <crucialfelix@gmail.com>) |
Ответы |
Re: Really really slow select count(*)
|
Список | pgsql-performance |
On 02/04/2011 02:14 PM, felix wrote: > oh and there in the footnotes to django they say "dont' forget to run > the delete expired sessions management every once in a while". > thanks guys. Oh Django... :) > it won't run now because its too big, I can delete them from psql though You might be better off deleting the inverse. You know, start a transaction, select all the sessions that *aren't* expired, truncate the table, insert them back into the session table, and commit. BEGIN; CREATE TEMP TABLE foo_1 AS SELECT * FROM django_session WHERE date_expired < CURRENT_DATE; TRUNCATE django_session; INSERT INTO django_session SELECT * from foo_1; COMMIT; Except I don't actually know what the expired column is. You can figure that out pretty quick, I assume. That'll also have the benefit of cleaning up the indexes and the table all at once. If you just do a delete, the table won't change at all, except that it'll have less active records. > well just think how sprightly my website will run tomorrow once I fix > these. Maybe. :) -- Shaun Thomas OptionsHouse | 141 W. Jackson Blvd. | Suite 800 | Chicago IL, 60604 312-676-8870 sthomas@peak6.com ______________________________________________ See http://www.peak6.com/email_disclaimer.php for terms and conditions related to this email
В списке pgsql-performance по дате отправления: