Re: extract(year from date) doesn't use index but maybe could?
| От | Yves Dorfsman |
|---|---|
| Тема | Re: extract(year from date) doesn't use index but maybe could? |
| Дата | |
| Msg-id | 5534269A.10605@zioup.com обсуждение исходный текст |
| Ответ на | Re: extract(year from date) doesn't use index but maybe could? (Tom Lane <tgl@sss.pgh.pa.us>) |
| Ответы |
Re: extract(year from date) doesn't use index but maybe could?
|
| Список | pgsql-performance |
On 2015-04-19 15:33, Tom Lane wrote: > >> It's possible that in the future someone will implement an optimization >> like this, but I'm not aware of anyone working on that and I wouldn't >> hold my breath. > > Yeah. In principle you could make the planner do this. As Adam Williams > notes nearby, there's a problem with lack of exact consistency between > extract() semantics and straight timestamp comparisons; but you could > handle that by extracting indexable expressions that are considered lossy, What about functions that are simpler such as upper()/lower()? On 9.3, this: `select email from users where lower(first_name) = 'yves'; is not using the index on first_name (Seq Scan on first_name). This should be easy to implement? -- http://yves.zioup.com gpg: 4096R/32B0F416
В списке pgsql-performance по дате отправления: