Re: [GENERAL] Poor select count(*) performance

2009-02-23 Thread Mike Ivanov
On Mon, Feb 23, 2009 at 6:54 PM, Sam Mason wrote: Depending on where these are on disk and how fast your disks are this > could take up to 30 seconds. This does not sound very inspiring :-) Would throwing more hardware (memory, faster CPU) at the server improve the situation? > If you want t

Re: [GENERAL] High cpu usage after many inserts

2009-02-23 Thread Jordan Tomkinson
On Tue, Feb 24, 2009 at 11:42 AM, Greg Smith wrote: > > Right, the useful thing to do in this case is to take a look at how big all > the relations (tables, indexes) involved are at each of the steps in the > process. The script at http://wiki.postgresql.org/wiki/Disk_Usage will > show you that.

Re: [GENERAL] javascript and postgres

2009-02-23 Thread Scott Marlowe
On Mon, Feb 23, 2009 at 11:54 PM, Craig Ringer wrote: > 野村 wrote: >> Hello all. >> >> My javascript connects with postgres using php. >> php responds with XML for my select request. >> I wonder is there any way to access to postgres directly? > > Nothing stops you passing SQL snippets from JavaScr

Re: [GENERAL] javascript and postgres

2009-02-23 Thread John R Pierce
野村 wrote: > Hello all. > > My javascript connects with postgres using php. > php responds with XML for my select request. > I wonder is there any way to access to postgres directly? > if you mean client side Javascript running on the end users web browser, no, it should NOT be allowed to connec

Re: [GENERAL] javascript and postgres

2009-02-23 Thread Craig Ringer
野村 wrote: > Hello all. > > My javascript connects with postgres using php. > php responds with XML for my select request. > I wonder is there any way to access to postgres directly? Nothing stops you passing SQL snippets from JavaScript into your PHP code, which then dispatches then to the server

Re: [GENERAL] High cpu usage after many inserts

2009-02-23 Thread Jordan Tomkinson
On Tue, Feb 24, 2009 at 11:42 AM, Greg Smith wrote: > On Mon, 23 Feb 2009, Scott Marlowe wrote: > > well that's pretty normal as the indexes grow large enough to not fit in >> cache, then not fit in memory, etc... >> > > Right, the useful thing to do in this case is to take a look at how big all

Re: [GENERAL] surprising results with random()

2009-02-23 Thread Scott Marlowe
On Mon, Feb 23, 2009 at 5:16 PM, raf wrote: > this looks like an attempt to understand the monty hall problem. > http://en.wikipedia.org/wiki/Monty_Hall_problem > except that there's no goat :( And what database management system can be complete without a goat? :) -- Sent via pgsql-general mai

[GENERAL] javascript and postgres

2009-02-23 Thread 野村
Hello all. My javascript connects with postgres using php. php responds with XML for my select request. I wonder is there any way to access to postgres directly? I mean like this. new PGSQL.Request ( 'postgres.server.com' ,{ ,port: 5432 ,sql : 'select *

[GENERAL] PostgreSQL fast query is too slow as function

2009-02-23 Thread Eus
Hi Ho! The plain query runs for about 8.28 minutes. But, when the same query is put inside a function as follows: --- 8< --- create or replace function get_outgoing_transactions( area char(3), start_at timestamp with time zone, end_at timestamp with time zone) returns setof record as

Re: [GENERAL] Poor select count(*) performance

2009-02-23 Thread Sam Mason
On Mon, Feb 23, 2009 at 05:44:05PM -0800, Mike Ivanov wrote: > An hour ago it took 8 seconds, one minute ago the same query took just only > 7 milliseconds. > > Any ideas why the execution time varies so wildly? > > Explain Analyze gives: > > Aggregate (cost=2000.08..2000.09 rows=1 width=0) (ac

Re: [GENERAL] Product Roadmap question and request for recommendation

2009-02-23 Thread Bruce Momjian
Dot Yet wrote: > don't fix if it ain't broken ;) > > no really, if the system is capable of working nearly flawlessly till 8.4 is > baked, then it is sound to wait till then, especially when upgrading to a > newer version is a *painful* as in time consuming task. i am assuming > downgrading (just

Re: [GENERAL] High cpu usage after many inserts

2009-02-23 Thread Greg Smith
On Mon, 23 Feb 2009, Scott Marlowe wrote: well that's pretty normal as the indexes grow large enough to not fit in cache, then not fit in memory, etc... Right, the useful thing to do in this case is to take a look at how big all the relations (tables, indexes) involved are at each of the step

Re: [GENERAL] Poor select count(*) performance

2009-02-23 Thread Scott Marlowe
On Mon, Feb 23, 2009 at 6:44 PM, Mike Ivanov wrote: > Hi there, > > I'm sorry for a stupid question but I'm really stuck. > > A query: > > SELECT COUNT(*) FROM "lingq_card" WHERE "lingq_card"."context_id" = ...; > > An hour ago it took 8 seconds, one minute ago the same query took just only > 7 mi

[GENERAL] Poor select count(*) performance

2009-02-23 Thread Mike Ivanov
Hi there, I'm sorry for a stupid question but I'm really stuck. A query: SELECT COUNT(*) FROM "lingq_card" WHERE "lingq_card"."context_id" = ...; An hour ago it took 8 seconds, one minute ago the same query took just only 7 milliseconds. Any ideas why the execution time varies so wildly? Expl

Re: [GENERAL] High cpu usage after many inserts

2009-02-23 Thread Jordan Tomkinson
On Tue, Feb 24, 2009 at 12:35 AM, Scott Marlowe wrote: > On Mon, Feb 23, 2009 at 1:29 AM, Jordan Tomkinson > wrote: > > As per the spreadsheet > > (http://spreadsheets.google.com/pub?key=pu_k0R6vNvOVP26TRZdtdYw) CPU > usage > > is around 50% and starts climbing over 3 hours until we have just und

Re: [GENERAL] surprising results with random()

2009-02-23 Thread raf
Steve Atkins wrote: > > On Feb 23, 2009, at 2:09 PM, Jessi Berkelhammer wrote: > > >Hi, > > > >I have a view in which I want to randomly assign values if certain > >conditions hold. I was getting surprising results. Here is a (very) > >simplified version of the view, which seems to indicate the

Re: [Fwd: Re: [GENERAL] surprising results with random()]

2009-02-23 Thread Tom Lane
John R Pierce writes: > ries van Twisk wrote: >> should the function not look like this??? >> >> CREATE OR REPLACE VIEW test_view AS >> SELECT >> CASE >> WHEN random() < .3 THEN '1' >> WHEN random() < .5 THEN '2' >> ELSE '3' >> END AS test_value >> >> FROM client; > actually, I'd think

Re: [GENERAL] surprising results with random()

2009-02-23 Thread Brent Wood
Or perhaps: CREATE OR REPLACE VIEW test_view AS SELECT (random()*3)::int as test_value; At least in this case, that should give the same result. in this case 1/3 should be 1, 1/3 = 2 & 1/3=3 in your case 1/3 = 1, 1/2 the remainder (1/2 * 2/3 = 1/3) = 2, remaining 1/3 = 3 Although I'm guessing

[Fwd: Re: [GENERAL] surprising results with random()]

2009-02-23 Thread John R Pierce
ries van Twisk wrote: Jessi, should the function not look like this??? CREATE OR REPLACE VIEW test_view AS SELECT CASE WHEN random() < .3 THEN '1' WHEN random() < .5 THEN '2' ELSE '3' END AS test_value FROM client; actually, I'd think that should be

Re: [GENERAL] surprising results with random()

2009-02-23 Thread ries van Twisk
Jessi, should the function not look like this??? CREATE OR REPLACE VIEW test_view AS SELECT CASE WHEN random() < .3 THEN '1' WHEN random() < .5 THEN '2' ELSE '3' END AS test_value FROM client; On Feb 23, 2009, at 5:09 PM,

Re: [GENERAL] surprising results with random()

2009-02-23 Thread Steve Atkins
On Feb 23, 2009, at 2:09 PM, Jessi Berkelhammer wrote: Hi, I have a view in which I want to randomly assign values if certain conditions hold. I was getting surprising results. Here is a (very) simplified version of the view, which seems to indicate the problem: CREATE OR REPLACE VIEW test_vi

Re: [GENERAL] problems with win32 enterprisedb 8.3.6 ssl=on

2009-02-23 Thread raf
Dave Page wrote: > On Mon, Feb 23, 2009 at 7:55 AM, raf wrote: > > hi, > > > > i've been getting nonsensical error messages all day with > > postgres 8.3 on winxpsp3. i tried upgrading to 8.3.6 > > (enterprisedb) and fresh installs. > > Please clarify what you have done. You cannot upgrade from

[GENERAL] surprising results with random()

2009-02-23 Thread Jessi Berkelhammer
Hi, I have a view in which I want to randomly assign values if certain conditions hold. I was getting surprising results. Here is a (very) simplified version of the view, which seems to indicate the problem: CREATE OR REPLACE VIEW test_view AS SELECT CASE WHEN random() <

Re: [GENERAL] Product Roadmap question and request for recommendation

2009-02-23 Thread Scott Marlowe
On Mon, Feb 23, 2009 at 1:03 PM, Keaton Adams wrote: > OK, well just to make sure I have the latest and greatest information on the > proposed in-place upgrade process. > > If we go from 8.1 to 8.3.6 now using dump/restore we will need to do another > dump/restore to get to 8.4, correct? Or you c

[GENERAL] Re: overlaps behaviour - ('2006-03-01'::TimeStamp, '2007-12-01'::TimeStamp) overlaps ('2007-12-01'::TimeStamp, 'Infinity'::TimeStamp)

2009-02-23 Thread Marek Lewczuk
2009/2/23 Marek Lewczuk : > Hello, > I can't find SQL definition for OVERLAPS operator so I don't know > whether following expression's result (false) is appropriate > behaviour: > select ('2006-03-01'::TimeStamp, '2007-12-01'::TimeStamp) overlaps > ('2007-12-01'::TimeStamp, 'Infinity'::TimeStamp)

Re: [GENERAL] Backup Strategy Second Opinion

2009-02-23 Thread Tim Uckun
If you could publish a brief howto on this I would be most grateful. I bet many others would too. On Mon, Feb 23, 2009 at 2:56 PM, Bryan Murphy wrote: > On Sun, Feb 22, 2009 at 7:30 PM, Tim Uckun wrote: > >> 1. It's OK if we lose a few seconds (or even minutes) of transactions > >> should one

Re: [GENERAL] High cpu usage after many inserts

2009-02-23 Thread Markus Wanner
Hi, Scott Marlowe wrote: > Oh, what is an LMS? A Learning Management System, not to be confused with a CMS, which might also stand for a Course Management System ;-) Regards Markus Wanner -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscripti

[GENERAL] speaking of 8.4...

2009-02-23 Thread John R Pierce
is it looking like the simple replication will make it into 8.4? if so, are there any docs or notes I could peruse on how this will work? what it will use to ship the WAL logs, etc ? I've poked around the -hacker mail list archives and not found too much on it. -- Sent via pgsql-genera

Re: [GENERAL] Product Roadmap question and request for recommendation

2009-02-23 Thread Andreas Kretschmer
Tom Lane wrote: > Keaton Adams writes: > > We are currently at PG 8.1 and are in the process of upgrading to 8.3.6. I > > read on your development roadmap page that 8.4 is slated for release in Q1 > > of this year, possibly on the 31st of March: > > > "The next release of PostgreSQL is plann

Re: [GENERAL] Product Roadmap question and request for recommendation

2009-02-23 Thread Keaton Adams
OK, well just to make sure I have the latest and greatest information on the proposed in-place upgrade process. If we go from 8.1 to 8.3.6 now using dump/restore we will need to do another dump/restore to get to 8.4, correct? And from 8.4 on we will be able to do in-place upgrades? The idea of b

Re: Fwd: [GENERAL] Connection refused (0x0000274D/10061)

2009-02-23 Thread Andreas Kretschmer
najmuddin hassan schrieb: > I've have AVG installed and I've remove it and I've turn off the windows > firewall. Maybe your AVG is the problem... don't know, i'm not familiar with windoze and so on... > > When I go to PostgreSQL 8.3 > Start > > The command prompt window appears with text. >

Re: [GENERAL] Product Roadmap question and request for recommendation

2009-02-23 Thread Tom Lane
Keaton Adams writes: > We are currently at PG 8.1 and are in the process of upgrading to 8.3.6. I > read on your development roadmap page that 8.4 is slated for release in Q1 of > this year, possibly on the 31st of March: > "The next release of PostgreSQL is planned to be the 8.4 release. A te

Re: [GENERAL] Function that returns Boolean

2009-02-23 Thread David Fetter
On Mon, Feb 23, 2009 at 09:39:01AM -0800, SHARMILA JOTHIRAJAH wrote: > Hi, > This is a simple function that returns a boolean .. This should be an SQL function, as it doesn't do anything you need (or would even find convenient) for a more procedural language to do: CREATE OR REPLACE FUNCTION chec

Re: [GENERAL] Product Roadmap question and request for recommendation

2009-02-23 Thread Dot Yet
don't fix if it ain't broken ;) no really, if the system is capable of working nearly flawlessly till 8.4 is baked, then it is sound to wait till then, especially when upgrading to a newer version is a *painful* as in time consuming task. i am assuming downgrading (just incase things don't workout

Re: [GENERAL] Function that returns Boolean

2009-02-23 Thread Richard Broersma
On Mon, Feb 23, 2009 at 9:39 AM, SHARMILA JOTHIRAJAH wrote: >IF ( newValue != oldValue) One good piece of advice that Tom Lane pointed out to me was: IF ( newValue IS DISTINCT FROM oldValue ) is better due to (what may be) the unexpected results of equality testing when NULL values are thr

[GENERAL] Product Roadmap question and request for recommendation

2009-02-23 Thread Keaton Adams
What would you do in this situation? We are currently at PG 8.1 and are in the process of upgrading to 8.3.6. I read on your development roadmap page that 8.4 is slated for release in Q1 of this year, possibly on the 31st of March: "The next release of PostgreSQL is planned to be the 8.4 relea

Re: [GENERAL] Function that returns Boolean

2009-02-23 Thread Adrian Klaver
- "SHARMILA JOTHIRAJAH" wrote: > Hi, > This is a simple function that returns a boolean .. > > create or replace function check_value( newValue IN VARCHAR, > oldValue IN VARCHAR ) RETURN BOOLEAN ^^ RETURNS > as > ' > BEGIN

Re: [GENERAL] Function that returns Boolean

2009-02-23 Thread Tom Lane
SHARMILA JOTHIRAJAH writes: > create or replace function check_value( newValue IN VARCHAR, > oldValue IN VARCHAR ) RETURN BOOLEAN Should be RETURNS BOOLEAN. You might want to fix whatever client code you are using so that it shows the error cursor, which would certainly have

Re: [GENERAL] Function that returns Boolean

2009-02-23 Thread SHARMILA JOTHIRAJAH
Its a typo..it should be "RETURNS BOOLEAN" and not "RETURN BOOLEAN" -Sharmila --- On Mon, 2/23/09, SHARMILA JOTHIRAJAH wrote: > From: SHARMILA JOTHIRAJAH > Subject: Function that returns Boolean > To: "General postgres mailing list" > Date: Monday, February 23, 2009, 12:39 PM > Hi, > This is

[GENERAL] Function that returns Boolean

2009-02-23 Thread SHARMILA JOTHIRAJAH
Hi, This is a simple function that returns a boolean .. create or replace function check_value( newValue IN VARCHAR, oldValue IN VARCHAR ) RETURN BOOLEAN as ' BEGIN IF ( newValue != oldValue) then return true; else return false; END IF; END; ' LANGU

[GENERAL] Serverlog postgresql 8.1.11

2009-02-23 Thread Angelo Astorga
Antiguamente utiilizaba postgresql 7.4.3 donde se generaba un serverlog en directorio .../data/serverlog, ahora con vers. 8.1.11 no encuentro el serverlog... alguna ayuda al respecto !!!

Re: [GENERAL] High cpu usage after many inserts

2009-02-23 Thread Scott Marlowe
On Mon, Feb 23, 2009 at 1:29 AM, Jordan Tomkinson wrote: > > On Mon, Feb 23, 2009 at 5:20 PM, Scott Marlowe > wrote: >> >> On Mon, Feb 23, 2009 at 12:42 AM, Jordan Tomkinson >> wrote: >> > >> > >> > On Mon, Feb 23, 2009 at 4:29 PM, Scott Marlowe >> > wrote: >> >> >> >> Oh yeah, what OS is this?

Re: [GENERAL] Connection refused (0x0000274D/10061)

2009-02-23 Thread Tom Lane
najmuddin hassan writes: > I just installed a program called moteview by crossbow technologies. It uses > postgreSQL 8.0.0-rc1 for its database. Egad. Based on that statement alone, I will tell you that crossbow is a bunch of incompetent idiots and you should not trust their software in the slig

Fwd: [GENERAL] Connection refused (0x0000274D/10061)

2009-02-23 Thread najmuddin hassan
I've have AVG installed and I've remove it and I've turn off the windows firewall. When I go to PostgreSQL 8.3 > Start The command prompt window appears with text. "The PostgreSQL Database server 8.3 is starting" the dot will appear for sometime like something is running then the next msg

[GENERAL] restore single table

2009-02-23 Thread Kevin Duffy
Hello All: I need guidance on how move some changes that I have made to my production database. On my development database I made changes to a table called DEPT. I added a column, added a couple of records and did some general data cleanup What I did not do was change any of the keys

Re: [GENERAL] [pgsql-es-ayuda] Cambiando Postgresql 7.4.3 a 8.1.11 !!!

2009-02-23 Thread Silvio Quadri
El día 22 de febrero de 2009 17:46, Angelo Astorga escribió: > Tenia Red Hat enterprise 3.0 con postgresql 7.4.3 y PHP 4.3.2, por necesidad > de hardware migre todo a Red Hat enterprise 5.3 con postgresql 8.1.11 y PHP > 5.1.6 (default del sistema operativo), si bien puedo crear y recuperar > la BD

Re: [GENERAL] Connection refused (0x0000274D/10061)

2009-02-23 Thread A. Kretschmer
In response to najmuddin hassan : > Hi, > > I just installed a program called moteview by crossbow technologies. It uses > postgreSQL 8.0.0-rc1 for its database. There is something wrong as when I > launched the program it automaticly gives me an error that the database is not > available. The po

[GENERAL] Connection refused (0x0000274D/10061)

2009-02-23 Thread najmuddin hassan
Hi, I just installed a program called moteview by crossbow technologies. It uses postgreSQL 8.0.0-rc1 for its database. There is something wrong as when I launched the program it automaticly gives me an error that the database is not available. The postgreSQL database installation is bundled toget

Re: [GENERAL] PostgreSQL CE?

2009-02-23 Thread Emanuel Calvo Franco
2009/2/22 Gerd Koenig : > Hi Steve, > > I know that EnterpriseDB offers 3 levels of certification. > Perhaps one of them suits your needs..?!?! > > regards...:GERD:... > > Pearson has 2 levels (gold and plate) [1] Regards, [1] http://www.vue.com/sra/ > > steve.gnuli...@gmail.com schrieb: >> >> J

[GENERAL] Date range problem on pg_restore

2009-02-23 Thread Dick Kniep
Hi list,   We have a peculiar problem with a restore.   We have a database with many different schema's that all act as separate databases.   The data is backed up from postgresql 8.1 with the following commands in cron:   28 12 * * * /usr/bin/pg_dump -a -F c --disable-triggers -f /srv/

Re: [GENERAL] PostgreSQL clustering with DRBD

2009-02-23 Thread Serge Fonville
Thanks all for the responses, We're very happy with pgpool-II for load-balancing and multi-master usage of PostgreSQL (keep in mind to enable HA for pgpool-II itself to avoid a SPOF, e.g. with heartbeat). I could not determine whether pgpool-II is suitable for what I want. It does not seem to

Re: [GENERAL] PostgreSQL clustering with DRBD

2009-02-23 Thread Tim Uckun
> > We're very happy with pgpool-II for load-balancing and multi-master > usage of PostgreSQL (keep in mind to enable HA for pgpool-II itself to > avoid a SPOF, e.g. with heartbeat). > > Thanks. I am going to see which one has better documentation and try that one first.

Re: [GENERAL] problems with win32 enterprisedb 8.3.6 ssl=on

2009-02-23 Thread Dave Page
On Mon, Feb 23, 2009 at 7:55 AM, raf wrote: > hi, > > i've been getting nonsensical error messages all day with > postgres 8.3 on winxpsp3. i tried upgrading to 8.3.6 > (enterprisedb) and fresh installs. Please clarify what you have done. You cannot upgrade from PostgreSQL to EnterpriseDB (Postgr

Re: [GENERAL] High cpu usage after many inserts

2009-02-23 Thread Jordan Tomkinson
On Mon, Feb 23, 2009 at 5:20 PM, Scott Marlowe wrote: > On Mon, Feb 23, 2009 at 12:42 AM, Jordan Tomkinson > wrote: > > > > > > On Mon, Feb 23, 2009 at 4:29 PM, Scott Marlowe > > wrote: > >> > >> Oh yeah, what OS is this? Version and all that. > > > > I should probably clarify that the high cpu

Re: [GENERAL] High cpu usage after many inserts

2009-02-23 Thread Scott Marlowe
On Mon, Feb 23, 2009 at 12:42 AM, Jordan Tomkinson wrote: > > > On Mon, Feb 23, 2009 at 4:29 PM, Scott Marlowe > wrote: >> >> Oh yeah, what OS is this? Version and all that. > > I should probably clarify that the high cpu only exists while the jmeter > tests are running, once the tests are finis

Re: [GENERAL] High cpu usage after many inserts

2009-02-23 Thread Jordan Tomkinson
Scott, DB Schema: http://demo.moodle.org/db_schema.txt SQL Query log: http://demo.moodle.org/querylog.txt There are _much_ more queries than I anticipated :/ Jordan