BUG #7651: Superfluous calls to functions used for indexing
От | m-pg@8d.no |
---|---|
Тема | BUG #7651: Superfluous calls to functions used for indexing |
Дата | |
Msg-id | E1TXZjO-0000S2-1e@wrigleys.postgresql.org обсуждение исходный текст |
Ответы |
Re: BUG #7651: Superfluous calls to functions used for
indexing
Re: BUG #7651: Superfluous calls to functions used for indexing |
Список | pgsql-bugs |
The following bug has been logged on the website: Bug reference: 7651 Logged by: Morten Minde Neergaard Email address: m-pg@8d.no PostgreSQL version: 9.1.6 Operating system: Debian Wheezy Description: = Bug: When making an index over a function, then selecting a result that does not contain the function call (but orders on it), Superfluous function calls are made. This possibly because the plan creates a projection containing the function value. Steps to reproduce: 1. Create a function that gives you a immutable reply. In my real function, runtime is several ms. The SQL script referred to at the bottom contains a more minimal, if horribly ugly, example. It prints a NOTICE every time it is run. = 2. Use this function to create an index. In the attached example, this prints one NOTICE for each row, as expected. = 3. Select a small number of rows using e.g. ORDER BY and LIMIT. This returns correctly, but takes longer than expected to execute. The NOTICE is printed five times, even though the function should not need be called. I have made a minimal script reproducing this, and run it with simple test data. All URLs below. SQL script: http://xim.akuma.no/psql_bug/psql_bug.txt Script output: http://xim.akuma.no/psql_bug/psql_bug_log.txt Data for test: http://xim.akuma.no/psql_bug/file_containing_ints
В списке pgsql-bugs по дате отправления: