Date + Days = Date
От | Bob Dusek |
---|---|
Тема | Date + Days = Date |
Дата | |
Msg-id | Pine.LNX.3.96.990203213514.196H-100000@temp.palaver.net обсуждение исходный текст |
Список | pgsql-general |
hey all, Thanks, everyone, for the info you gave me on the cost of joins and GEQO. That stuff was helpful and I'm working on solving my "slowness" problems right now. And, I've stumbled upon another question. I've noticed that date comparison seems to be somewhat slow, especially when sifting through an entire electronic inventory trying to find inventory that is, say, more than one month old. What I do in my query is something like: select info from tables where item.date <= max.date and item.date >= min.date; I also do a query that is something like this: select 'now'::date - item.date as days_old from item where ......; This sort of date comparison may not be a major bottleneck, but to my understanding this sort of date comparison is slower than integer comparison. (Does anyone have any data on that?) So, what I might do is go to a "day" tracking system, rather than a "date" tracking system. The very first date that an inventory item was entered into the system will be day 1. The next day = day 2, etc... PostgreSQL's "select date('now'::date + 400)" functionality allows me to do this, since it returns the actual date 400 days from right now. Is this functionality accurate, in terms of leap year quirks? TIA, Bob
В списке pgsql-general по дате отправления: