Search Postgresql Archives

Strange variable behaviour when using it in limit clause in plpgsql stored procedure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I tested performance of my query with limit clause inside plpgsql procedure. 2 slightly different situations:

1. Sql with limit clause and literal variable (for example 'select field1 from table1 limit 100')
2. The same sql with limit clause and pgplsql variable  (for example 'select field1 from table1 limit vilimit'). vilimit defined in declare section.

At first I compared execution plans. they were absolutely equal!
But in fact first procedure was 10 times!!!! faster then the second! What's the problem?!?!
Note: tested sql was complex enough. I didn't test this case on simple query like 'select field1 from table1 limit 100'.

--
Sincerely,
Sergey Moroz

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux