Re: Week numbers and calculating weekly statistics/diagrams
Вложения
В списке pgsql-general по дате отправления:
| От | Martijn van Oosterhout |
|---|---|
| Тема | Re: Week numbers and calculating weekly statistics/diagrams |
| Дата | |
| Msg-id | 20100216124757.GA10778@svana.org обсуждение |
| Ответ на | Week numbers and calculating weekly statistics/diagrams (Alexander Farber <alexander.farber@gmail.com>) |
| Список | pgsql-general |
On Tue, Feb 16, 2010 at 01:14:26PM +0100, Alexander Farber wrote: > Does anybody has an advice how to save the week number? > > If I save it as a timestamp then calculating realtime statistics > (on a player profile click) will probably be CPU-intensive, > because I have to calculate the week numbers each time. You should probably seperate the storage from the representation. The easiest way of storing the information of a week is the date of the first day (after all, a week could begin on a sunday or monday, depending on your point of view). This will make grouping and searching quick, as it's just an integer. If you really wanted to you could choose an epoch and count weeks from there but I doubt that's worth the effort. As for how you represent it to the users, you'll have to create some conversion routine for output, but I seriously doubt that's going to be a bottleneck. Have a nice day, -- Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/ > Please line up in a tree and maintain the heap invariant while > boarding. Thank you for flying nlogn airlines.
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера