Re: [PERFORM] Analysis Function

2010-06-13 Thread Heikki Linnakangas
On 11/06/10 23:38, David Jarvis wrote: I added an explicit cast in the SQL: dateserial(extract(YEAR FROM m.taken)::int,'||p_month1||','||p_day1||') d1, dateserial(extract(YEAR FROM m.taken)::int,'||p_month2||','||p_day2||') d2 The function now takes three integer parameters;

Re: [PERFORM] Analysis Function

2010-06-13 Thread David Jarvis
Hi, We had a little chat about this with Magnus. It's pretty surprising that there's no built-in function to do this, we should consider adding one. I agree; you should be able to create a timestamp or a date from integer values. Others, apparently, have written code. The implementation I did

Re: [PERFORM] Analysis Function

2010-06-13 Thread Magnus Hagander
On Sun, Jun 13, 2010 at 09:38, David Jarvis thanga...@gmail.com wrote: Hi, We had a little chat about this with Magnus. It's pretty surprising that there's no built-in function to do this, we should consider adding one. I agree; you should be able to create a timestamp or a date from integer

Re: [PERFORM] query hangs

2010-06-13 Thread AI Rumman
Any more idea, please. Is table partition a good solution for query optimization? On Fri, Jun 11, 2010 at 11:09 AM, Amit Khandekar amit.khande...@enterprisedb.com wrote: On 10 June 2010 18:47, AI Rumman rumman...@gmail.com wrote: I am using Postgresql 8.1 and did not find FETCH_COUNT Oh

[PERFORM] out of memory

2010-06-13 Thread AI Rumman
Whenever I run this query, I get out of memory error: explain analyze *select * email_track.count AS Emails_Access_Count, activity.subject AS Emails_Subject, crmentity.crmid AS EntityId_crmentitycrmid *from * (select * from crmentity where deleted = 0 and createdtime between (now() - interval '6

Re: [PERFORM] out of memory

2010-06-13 Thread Anj Adu
Can you provide these details work_mem How much physical memory there is on your system Most out of memory errors are associated with a high work_mem setting On Sun, Jun 13, 2010 at 6:25 AM, AI Rumman rumman...@gmail.com wrote: Whenever I run this query, I get out of memory error: explain

Re: [PERFORM] Analysis Function

2010-06-13 Thread Tom Lane
Heikki Linnakangas heikki.linnakan...@enterprisedb.com writes: We could have a function like: construct_timestamp(year int4, month int4, date int4, hour int4, minute int4, second int4, milliseconds int4, timezone text) This fails to allow specification to the microsecond level (and note that

Re: [PERFORM] Analysis Function

2010-06-13 Thread Tom Lane
Magnus Hagander mag...@hagander.net writes: On Sun, Jun 13, 2010 at 09:38, David Jarvis thanga...@gmail.com wrote: Does it makes sense to use named parameter notation for the first value (the year)? This could be potentially confusing: How so? If it does named parameters, why not all?

Re: [PERFORM] Analysis Function

2010-06-13 Thread Magnus Hagander
On Sun, Jun 13, 2010 at 17:42, Tom Lane t...@sss.pgh.pa.us wrote: Magnus Hagander mag...@hagander.net writes: On Sun, Jun 13, 2010 at 09:38, David Jarvis thanga...@gmail.com wrote: Does it makes sense to use named parameter notation for the first value (the year)? This could be potentially

Re: [PERFORM] Analysis Function

2010-06-13 Thread Tom Lane
Magnus Hagander mag...@hagander.net writes: On Sun, Jun 13, 2010 at 17:42, Tom Lane t...@sss.pgh.pa.us wrote: ... (We presumably want timezone to default to the system timezone setting, but I wonder how we should make that work --- should an empty string be treated as meaning that?) Umm.

Re: [PERFORM] Analysis Function

2010-06-13 Thread David Jarvis
Hi, It's not immediately obvious what the default value of timezone will be? The system's locale, like now(); documentation can clarify. By named parameter, I meant default value. You could construct a timestamp variable using: construct_timestamp( year := 1900, hour := 1 ) When I read

Re: [PERFORM] out of memory

2010-06-13 Thread Kenichiro Tanaka
Hello I think this SQL returns the following error. ERROR: missing FROM-clause entry for table email_track LINE 3: email_track.count AS Emails_Access_Count, ^ For a fact ,this SQL does not have the email_trac table in from-clause. 1)Is this SQL right? 2)If the SQL is right, can you

Re: [PERFORM] Query about index usage

2010-06-13 Thread Jayadevan M
PostgreSQL can't currently avoid reading the table, because that's where the tuple visibility information is stored. We've been making progress toward having some way to avoid reading the table for all except very recently written tuples, but we're not there yet (in any production version or