Re: [PERFORM] Slow query to get last created row using CURRVAL

2010-12-04 Thread Marti Raudsepp
On Sat, Dec 4, 2010 at 13:56, Mathieu De Zutter math...@dezutter.org wrote: I have no idea why in some cases the index scan is not considered. Does anyone have an idea? I guess that it's because the currval() function is volatile -- its value has to be tested for again each row. Try this

Re: [PERFORM] Slow query to get last created row using CURRVAL

2010-12-04 Thread Mathieu De Zutter
On Sat, Dec 4, 2010 at 1:35 PM, Marti Raudsepp ma...@juffo.org wrote: On Sat, Dec 4, 2010 at 13:56, Mathieu De Zutter math...@dezutter.org wrote: I have no idea why in some cases the index scan is not considered. Does anyone have an idea? I guess that it's because the currval() function is

Re: [PERFORM] Slow query to get last created row using CURRVAL

2010-12-04 Thread Віталій Тимчишин
2010/12/4 Mathieu De Zutter math...@dezutter.org For each page load I first create an entry in that table, e.g.: INSERT INTO log_event (user_id, ip, action_id, object1_id, object2_id, event_timestamp, comments) VALUES (1, '127.0.0.1', 96, null, null, NOW(), 'TEST'); After that, I want to