Thursday, August 7, 2008

Re: [PERFORM] Plz Heeeelp! performance settings

The performance problem is really only on the insertion and even more on
the treatment for the aggregation.

To treat the 3000 entrances and to insert, or update the tables it needs
10 minutes.

As I told you I inject 14000 query every 2 minutes, and it needs 10
minutes to treat 3000 of those query.

As you can easly understand it's a big narrow section.

I'm not doing the treatment in ones, cause I can't, but all is managed
by procedure.

> That wasn't a yes/no question. Please choose one of:
> Are you updating 6Go per week? most of update
> Are you adding 6Go per week? less of injection,

This action depend if the data are already present in the database.


>
> OK. I assume you're happy with the plans you are getting on these
> queries, since you've not provided any information about them.

The plan seems ok as it use index as well.
here is the plan :

explain analyse SELECT "insertUpdateTracks"(137,2605, 852, ('2008-08-06
19:28:54'::text)::date,3,'dailydisplay',2,NULL);
INFO: method 1
QUERY PLAN
------------------------------------------------------------------------------------
Result (cost=0.00..0.01 rows=1 width=0) (actual time=1.151..1.151
rows=1 loops=1)
Total runtime: 1.160 ms
(2 lignes)

Has you can see the runtime processs for an update in this table.

multiplying this per 10000, it is too long.

regards

david


Richard Huxton a écrit :
> dforums wrote:
>> vmstat is giving :
>> procs -----------memory---------- ---swap-- -----io---- --system--
>> ----cpu----
>> r b swpd free buff cache si so bi bo in cs us
>> sy id wa
>> 0 2 1540 47388 41684 7578976 0 0 131 259 0 1 9
>> 3 82 7
>
> This system is practically idle. Either you're not measuring it at a
> useful time, or there isn't a performance problem.
>
>> > > But
>> >> if I use a second machine to replicate the database, I escape this
>> >> problem isn't it ?
>> > You reduce the chance of a single failure causing disaster.
>> Not clear this reply. It's scare me ....
>
> If server A fails, you still have server B. If server A fails so that
> replication stops working and you don't notice, server B won't help any
> more.
>
>> > What do you mean by "take 6Go per week"? You update/delete that much
>> > data? It's growing by that amount each week?
>> YES
>
> That wasn't a yes/no question. Please choose one of:
> Are you updating 6Go per week?
> Are you adding 6Go per week?
>
>> > I'm not sure what "15000 request per 2 minutes and empty it into 10
>> min"
>> > means.
>> I insert 15000 datas every 2 min and delete 15000 every 10 min in
>> those tables
>> >
>> > Do you have 7500 requests per minute?
>> should be that, But in fact I'm not treating the datas in real time,
>> and I buffer the datas and push the data into the database every 2 min
>> > Are these updates?
>> during the delete the data are aggregated in other tables which make
>> updates
>
> OK, so every 2 minutes you run one big query that adds 15000 rows.
> Every 10 minutes you run one big query that deletes 15000 rows.
>
>> > To the "temporary storage"?
>>
>> > What is this "temporary storage" - an ordinary table?
>> Yes, I thied to use temporary tables but I never been able to connect
>> this tables over 2 different session/connection, seems that is a
>> functionnality of postgresql, or a misunderstanding from me.
>
> That's correct - temporary tables are private to a backend (connection).
>
>> > > I'm making some update or select on tables including more than 20
>> > > millions of entrance.
>> >
>> > Again, I'm not sure what this means.
>>
>> To aggregate the data, I have to check the presence of others
>> information that are stores in 2 tables which includes 24 millions of
>> entrance.
>
> OK. I assume you're happy with the plans you are getting on these
> queries, since you've not provided any information about them.
>
>> > Oh - *important* - which version of PostgreSQL are you running?
>> 8.1.11
>> > Is an upgrade practical?
>> We are working of trying to upgrade to 8.3.3, but we are not yet ready
>> for such migration
>
> OK
>
>> > Looking at your postgresql.conf settings:
>> >
>> > max_connections = 624
>> >
>> > That's an odd number.
>> Now we could decrease this number, it's not so much usefull for now.
>> we could decrease is to 350.
>
> I don't believe you've got 350 active connections either. It will be
> easier to help if you can provide some useful information.
>
>> > effective_cache_size = 625000
>> >
>> > That's around 5GB - is that roughly the amount of memory used for
>> > caching (what does free -m say for buffers/cache)?
>> total used free shared buffers cached
>> Mem: 7984 7828 156 0 38 7349
>> -/+ buffers/cache: 440 7544
>> Swap: 509 1 508
>
> Not far off - free is showing 7349MB cached. You're not running 350
> clients there though - you're only using 440MB of RAM.
>
>
> I don't see anything to show a performance problem from these emails.
>

--
<http://www.1st-affiliation.fr>

*David Bigand
*Président Directeur Générale*
*51 chemin des moulins
73000 CHAMBERY - FRANCE

Web : htttp://www.1st-affiliation.fr
Email : david@1st-affiliation.com
Tel. : +33 479 696 685
Mob. : +33 666 583 836
Skype : firstaffiliation_support


--
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance

Re: [HACKERS] Visibility Groups

On Thu, 2008-08-07 at 13:30 +0100, Gregory Stark wrote:

> Hm, so backing up a bit from the specific proposed interface, the key here is
> being able to explicitly mark which tables your transaction will need in the
> future?

Think of it as a promise to touch nothing except a specific set of
tables. Whether you lock/access the full set of tables in the visibility
group is up to you.

Visibility groups would likely have overhead, so specifying them more
loosely would allow reasonable administration, yet retain benefit.

> Is it always just a handful of heavily updated tables that you want to
> protect?

Possibly. It seems easier to specify what you might touch, since
security may prevent you even knowing about the existence of other
tables.

> In that case we could have a lock type which means "I'll never need
> to lock this object". Then a session could issue "LOCK TABLE foo IN
> INACCESSIBLE MODE" or something like that. That requires people to hack up
> their pg_dump or replication script though which might be awkward.

Possibly

The main point is this information needs to be available on PGPROC, so
that new snapshots can see the visibility groups and then calculate
OldestXmin for each object as a result.

> Perhaps the way to do that would be to preemptively take locks on all the
> objects that you'll need, then have a command to indicate you won't need any
> further objects beyond those.

I seem to recall we track which objects we have already locked. Perhaps
we would use the explicit visibility group to mark all objects we are
allowed to lock, or mark those to avoid, depending upon which is smaller
list. Then any attempt to lock a new object would be straightforwardly
refused. We must do that cheaply and so that precludes any use of shared
resources such as the lock table.

If you'd like to run with this, I doubt I will have time to do anything
with it this release.

--
Simon Riggs www.2ndQuadrant.com
PostgreSQL Training, Services and Support


--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Re: [HACKERS] Visibility Groups

Simon Riggs wrote:
> On Thu, 2008-08-07 at 12:55 +0200, Jochem van Dieten wrote:
>> On Thu, Aug 7, 2008 at 12:38 PM, Simon Riggs wrote:
>>> I propose creating "Visibility Groups" that *explicitly* limit the
>>> ability of a transaction to access data outside its visibility group(s).
>> Doesn't every transaction need to access data from the catalogs?
>> Wouldn't the inclusion of a catalogs visibility group in every
>> transaction negate any potential benefits?
>
> True, but I don't see the catalogs as frequently updated data. The
> objective is to isolate frequently updated tables from long running
> statements that don't need to access them.
>
> Tables can be in multiple visibility groups, perhaps that wasn't clear.
> When we seek to vacuum a table, we take the lowest xmin of any group it
> was in when we took snapshot.

I'm not sure if "visibility group" is the best name for this - I had to
go away and think through what you meant about that last bit. Have I got
this right?

So - a "visibility group" is attached to a transaction.

My long-running transaction T0 can restrict itself to <catalogues> and
table "event_log".

Various other transactions T1..Tn make no promises about what they are
going to access. They all share the "null visibility group".

A table "user_emails" is in the "null visibility group" and can be
vacuumed based on whatever the lowest xid of T1..Tn is.

Table "event_log" is in both groups and can only be vacuumed based on
T0..Tn (presumably T0 is the oldest, since that's the point of the
exercise).

An attempt to write to user_emails by T0 will fail with an error.

An attempt to read from user_emails by T0 will be allowed?

What happens if I'm in ISOLATION LEVEL SERIALIZABLE? Presumably the read
is disallowed then too?

--
Richard Huxton
Archonet Ltd

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

[GENERAL] Need info on installer

Hi,
Greetings!!!

We have developed a software which uses PostgreSQL as one of the component.
We would like to delever PostgreSQL along with our software as a single package. So we have to create an installer which installs PostgreSQL with all pre-install configuration first and then our software.

Could you help me how to create a single installer? could you send PostgreSQL install script.

Thanks
Ram
Monster

[BUGS] Re: BUG #4343: upper, lower, initcap do not work with umlaute? (important!)

On Aug 6, 5:06 pm, kaeptn.hadd...@gmail.com ("paull") wrote:
> The following bug has been logged online:
>
> Bug reference:      4343
> Logged by:          paull
> Email address:      kaeptn.hadd...@gmail.com
> PostgreSQL version: 8.2? not sure
> Operating system:   ubuntu
> Description:        upper, lower, initcap do not work with umlaute?
> (important!)
> Details:
>
> Hello
>
> Sorry; I forgot to mention, that the Database is encoded in SQLASCII, so I
> suspect, that this is the source of the problem. Probably noone can fix it
> then.
> Sorry for creating unnecessary reports.
>
> Best regards
>
> ---------------------------------------
>
> I suspect this is no news, but then again, maybe noone ever bothered to
> report?
>
> I suspect that pgsql functions upper, lower and initcap do not support
> umlaute. If I query in phppgadmin like this:
>
> select
> initcap('xxx'),upper('xxx'),initcap('öÖöÖäÄäÄä'),upper('öÖöÖä­
> äÄä')
>
> the result is this:
> Xxx     XXX     öÖöÖäÄäÄä      öÖöÖäÄäÄä
>
> Hope this helps you
> Best regards
>
> --
> Sent via pgsql-bugs mailing list (pgsql-b...@postgresql.org)
> To make changes to your subscription:http://www.postgresql.org/mailpref/pgsql-bugs

see BUG #4319

--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Re: [PERFORM] Query Plan choice with timestamps

Giorgio Valoti wrote:
>
> On 07/ago/08, at 10:35, Richard Huxton wrote:
>
>> Giorgio Valoti wrote:
>>> Hi, I have a timestamptz field that I want to use with a query, but I
>>> don't need the full timestamp resolution, so I've created a
>>> day_trunc(timestamptz) immutable function which I'll use with the
>>> query and with a new index:
>>> logs=> create index test_idx on blackbox (day_trunc(ts));
>>> However, the query plan doesn't use the index:
>>
>> Does it use it ever? e.g. with
>> SELECT * FROM blackbox WHERE day_trunk(ts) = '...'
>
> It's used:
[snip]

OK - so the index is working.

If you disable seq-scans before running the query, does it use it then?

SET enable_seqscan = off;

> logs=>explain select count(*) from blackbox group by day_trunc(ts) order
> by day_trunc(ts);
> QUERY PLAN
>
------------------------------------------------------------------------------------------

>
> GroupAggregate (cost=98431.58..119773.92 rows=74226 width=8)

In particular:
1. Is the estimated cost more or less than 119773.92?
2. How does that match the actual time taken?

--
Richard Huxton
Archonet Ltd

--
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance

Re: [BUGS] BUG #4342: upper, lower, initcap do not work with umlaute?

On Aug 6, 4:48 pm, kaeptn.hadd...@gmail.com ("paull") wrote:
> The following bug has been logged online:
>
> Bug reference:      4342
> Logged by:          paull
> Email address:      kaeptn.hadd...@gmail.com
> PostgreSQL version: 8.2? not sure
> Operating system:   ubuntu
> Description:        upper, lower, initcap do not work with umlaute?
> Details:
>
> Hello
>
> I suspect this is no news, but then again, maybe noone ever bothered to
> report?
>
> I suspect that pgsql functions upper, lower and initcap do not support
> umlaute. If I query in phppgadmin like this:
>
> select
> initcap('xxx'),upper('xxx'),initcap('öÖöÖäÄäÄä'),upper('öÖöÖä­
> äÄä')
>
> the result is this:
> Xxx     XXX     öÖöÖäÄäÄä      öÖöÖäÄäÄä
>
> Hope this helps you
> Best regards
>
> --
> Sent via pgsql-bugs mailing list (pgsql-b...@postgresql.org)
> To make changes to your subscription:http://www.postgresql.org/mailpref/pgsql-bugs

locale of the database should be de_DE.utf8 (if the database is with
encoding UNICODE) or de_DE in case the encoding is LATIN1.

check it with

show lc_ctype
show database_encoding

You cannot officially change the locale of the database so
theoretically you can buckup and restore the database to the correctly
initialized database.

I have managed to chenge the control file and reindex the database and
do not see any problems yet.

--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Re: [PERFORM] Query Plan choice with timestamps

On 07/ago/08, at 10:35, Richard Huxton wrote:

> Giorgio Valoti wrote:
>> Hi, I have a timestamptz field that I want to use with a query, but
>> I don't need the full timestamp resolution, so I've created a
>> day_trunc(timestamptz) immutable function which I'll use with the
>> query and with a new index:
>> logs=> create index test_idx on blackbox (day_trunc(ts));
>> However, the query plan doesn't use the index:
>
> Does it use it ever? e.g. with
> SELECT * FROM blackbox WHERE day_trunk(ts) = '...'

It's used:

logs=> explain select * from blackbox where day_trunc(ts) =
day_trunc(now());
QUERY PLAN
---------------------------------------------------------------------------
Bitmap Heap Scan on blackbox (cost=22.38..3998.43 rows=1239
width=264)
Recheck Cond: (day_trunc(ts) = day_trunc(now()))
-> Bitmap Index Scan on date_idx (cost=0.00..22.07 rows=1239
width=0)
Index Cond: (day_trunc(ts) = day_trunc(now()))

--
Giorgio Valoti
--
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance

Re: [HACKERS] Visibility Groups

"Simon Riggs" <simon@2ndquadrant.com> writes:

> Currently, we calculate a single OldestXmin across all snapshots on the
> assumption that any transaction might access any table.
>
> I propose creating "Visibility Groups" that *explicitly* limit the
> ability of a transaction to access data outside its visibility group(s).
> By default, visibility_groups would be NULL, implying potential access
> to all tables.
>
> Once set, any attempt to lock an object outside of a transactions
> defined visibility_groups will result in an error:
> ERROR attempt to lock table outside of visibility group(s): foo
> HINT you need to set a different value for visibility_groups
> A transaction can only ever reduce or restrict its visibility_groups, it
> cannot reset or add visibility groups.

Hm, so backing up a bit from the specific proposed interface, the key here is
being able to explicitly mark which tables your transaction will need in the
future?

Is it always just a handful of heavily updated tables that you want to
protect? In that case we could have a lock type which means "I'll never need
to lock this object". Then a session could issue "LOCK TABLE foo IN
INACCESSIBLE MODE" or something like that. That requires people to hack up
their pg_dump or replication script though which might be awkward.

Perhaps the way to do that would be to preemptively take locks on all the
objects that you'll need, then have a command to indicate you won't need any
further objects beyond those.

--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
Ask me about EnterpriseDB's Slony Replication support!

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

[BUGS] BUG #4345: ERROR: OUT OF MEMORY

The following bug has been logged online:

Bug reference: 4345
Logged by: Glaucio Pedro
Email address: gpamaster@gmail.com
PostgreSQL version: 8.2
Operating system: Linux
Description: ERROR: OUT OF MEMORY
Details:

Dear Fellow,

I have been trying to restore a file through the pgAdmin (Version:1.8.2)and
the following message has been exhibited (although the metioned file´s size
is roughly 20kb):
"pg_restore [arquive] out of memory"


What is the solution for this problem?

Best Regards,

--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

[HACKERS] For what should pg_stop_backup wait?

Hi

In HEAD, pg_stop_backup waits until the history file has been archived.
But, in order to ensure that the last wal file was archived, pg_stop_backup
should wait until not only the history file but also the backup stopping wal
file has been archived, I think.

Because the alphabetic order of the history file and the backup stopping
wal file is not constant.

If the backup starting wal file is the same as the stopping one (that is,
any wal files were not switched during backup), the history file whose
name consists of the starting one is behind the stopping one.
Otherwise, the backup stopping wal file is behind the history file.

Is this worth fixing?

--
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

[HACKERS] patch: Add columns via CREATE OR REPLACE VIEW

Index: doc/src/sgml/ref/create_view.sgml
===================================================================
RCS file: /projects/cvsroot/pgsql/doc/src/sgml/ref/create_view.sgml,v
retrieving revision 1.36
diff -c -r1.36 create_view.sgml
*** doc/src/sgml/ref/create_view.sgml 3 Jul 2007 01:30:35 -0000 1.36
--- doc/src/sgml/ref/create_view.sgml 7 Aug 2008 11:22:33 -0000
***************
*** 36,44 ****

<para>
<command>CREATE OR REPLACE VIEW</command> is similar, but if a view
! of the same name already exists, it is replaced. You can only replace
! a view with a new query that generates the identical set of columns
! (i.e., same column names and data types).
</para>

<para>
--- 36,45 ----

<para>
<command>CREATE OR REPLACE VIEW</command> is similar, but if a view
! of the same name already exists, it is replaced. The new query must
! generate all of the same columns that were generated by the original query
! in the same order and with the same data types, but may add additional
! columns to the end of the list.
</para>

<para>
Index: src/backend/commands/tablecmds.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/commands/tablecmds.c,v
retrieving revision 1.261
diff -c -r1.261 tablecmds.c
*** src/backend/commands/tablecmds.c 16 Jul 2008 19:33:25 -0000 1.261
--- src/backend/commands/tablecmds.c 7 Aug 2008 11:22:39 -0000
***************
*** 2327,2332 ****
--- 2327,2338 ----
ATPrepAddColumn(wqueue, rel, recurse, cmd);
pass = AT_PASS_ADD_COL;
break;
+ case AT_AddColumnToView: /* add column via CREATE OR REPLACE VIEW */
+ ATSimplePermissions(rel, true);
+ /* Performs own recursion */
+ ATPrepAddColumn(wqueue, rel, recurse, cmd);
+ pass = AT_PASS_ADD_COL;
+ break;
case AT_ColumnDefault: /* ALTER COLUMN DEFAULT */

/*
***************
*** 2548,2553 ****
--- 2554,2560 ----
switch (cmd->subtype)
{
case AT_AddColumn: /* ADD COLUMN */
+ case AT_AddColumnToView: /* add column via CREATE OR REPLACE VIEW */
ATExecAddColumn(tab, rel, (ColumnDef *) cmd->def);
break;
case AT_ColumnDefault: /* ALTER COLUMN DEFAULT */
Index: src/backend/commands/view.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/commands/view.c,v
retrieving revision 1.106
diff -c -r1.106 view.c
*** src/backend/commands/view.c 19 Jun 2008 00:46:04 -0000 1.106
--- src/backend/commands/view.c 7 Aug 2008 11:22:39 -0000
***************
*** 174,181 ****
Assert(relation->istemp == rel->rd_istemp);

/*
* Create a tuple descriptor to compare against the existing view, and
! * verify it matches.
*/
descriptor = BuildDescForRelation(attrList);
checkViewTupleDesc(descriptor, rel->rd_att);
--- 174,206 ----
Assert(relation->istemp == rel->rd_istemp);

/*
+ * If new attributes have been added, we must modify the pre-existing
+ * view.
+ */
+ if (list_length(attrList) > rel->rd_att->natts) {
+ List *atcmds = NIL;
+ ListCell *c;
+ int skip = rel->rd_att->natts;
+
+ foreach(c, attrList) {
+ AlterTableCmd *atcmd;
+
+ if (skip > 0) {
+ --skip;
+ continue;
+ }
+ atcmd = makeNode(AlterTableCmd);
+ atcmd->subtype = AT_AddColumnToView;
+ atcmd->def = lfirst(c);
+ atcmds = lappend(atcmds, atcmd);
+ }
+ AlterTableInternal(viewOid, atcmds, true);
+ }
+
+ /*
* Create a tuple descriptor to compare against the existing view, and
! * verify that the old column list is an initial prefix of the new
! * column list.
*/
descriptor = BuildDescForRelation(attrList);
checkViewTupleDesc(descriptor, rel->rd_att);
***************
*** 220,232 ****
{
int i;

! if (newdesc->natts != olddesc->natts)
ereport(ERROR,
(errcode(ERRCODE_INVALID_TABLE_DEFINITION),
! errmsg("cannot change number of columns in view")));
/* we can ignore tdhasoid */

! for (i = 0; i < newdesc->natts; i++)
{
Form_pg_attribute newattr = newdesc->attrs[i];
Form_pg_attribute oldattr = olddesc->attrs[i];
--- 245,257 ----
{
int i;

! if (newdesc->natts < olddesc->natts)
ereport(ERROR,
(errcode(ERRCODE_INVALID_TABLE_DEFINITION),
! errmsg("cannot drop columns from view")));
/* we can ignore tdhasoid */

! for (i = 0; i < olddesc->natts; i++)
{
Form_pg_attribute newattr = newdesc->attrs[i];
Form_pg_attribute oldattr = olddesc->attrs[i];
***************
*** 235,241 ****
if (newattr->attisdropped != oldattr->attisdropped)
ereport(ERROR,
(errcode(ERRCODE_INVALID_TABLE_DEFINITION),
! errmsg("cannot change number of columns in view")));

if (strcmp(NameStr(newattr->attname), NameStr(oldattr->attname)) != 0)
ereport(ERROR,
--- 260,266 ----
if (newattr->attisdropped != oldattr->attisdropped)
ereport(ERROR,
(errcode(ERRCODE_INVALID_TABLE_DEFINITION),
! errmsg("cannot drop columns from view")));

if (strcmp(NameStr(newattr->attname), NameStr(oldattr->attname)) != 0)
ereport(ERROR,
Index: src/backend/parser/parse_utilcmd.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/parser/parse_utilcmd.c,v
retrieving revision 2.14
diff -c -r2.14 parse_utilcmd.c
*** src/backend/parser/parse_utilcmd.c 16 Jul 2008 01:30:22 -0000 2.14
--- src/backend/parser/parse_utilcmd.c 7 Aug 2008 11:22:41 -0000
***************
*** 1719,1724 ****
--- 1719,1725 ----
switch (cmd->subtype)
{
case AT_AddColumn:
+ case AT_AddColumnToView:
{
ColumnDef *def = (ColumnDef *) cmd->def;

Index: src/include/nodes/parsenodes.h
===================================================================
RCS file: /projects/cvsroot/pgsql/src/include/nodes/parsenodes.h,v
retrieving revision 1.371
diff -c -r1.371 parsenodes.h
*** src/include/nodes/parsenodes.h 7 Aug 2008 01:11:51 -0000 1.371
--- src/include/nodes/parsenodes.h 7 Aug 2008 11:22:43 -0000
***************
*** 907,912 ****
--- 907,913 ----
typedef enum AlterTableType
{
AT_AddColumn, /* add column */
+ AT_AddColumnToView, /* implicitly via CREATE OR REPLACE VIEW */
AT_ColumnDefault, /* alter column default */
AT_DropNotNull, /* alter column drop not null */
AT_SetNotNull, /* alter column set not null */
Index: src/test/regress/expected/create_view.out
===================================================================
RCS file: /projects/cvsroot/pgsql/src/test/regress/expected/create_view.out,v
retrieving revision 1.13
diff -c -r1.13 create_view.out
*** src/test/regress/expected/create_view.out 11 Jun 2008 21:53:49 -0000 1.13
--- src/test/regress/expected/create_view.out 7 Aug 2008 11:22:45 -0000
***************
*** 49,63 ****
-- should fail
CREATE OR REPLACE VIEW viewtest AS
SELECT a FROM viewtest_tbl WHERE a <> 20;
! ERROR: cannot change number of columns in view
-- should fail
CREATE OR REPLACE VIEW viewtest AS
SELECT 1, * FROM viewtest_tbl;
! ERROR: cannot change number of columns in view
-- should fail
CREATE OR REPLACE VIEW viewtest AS
SELECT a, b::numeric FROM viewtest_tbl;
ERROR: cannot change data type of view column "b"
DROP VIEW viewtest;
DROP TABLE viewtest_tbl;
-- tests for temporary views
--- 49,66 ----
-- should fail
CREATE OR REPLACE VIEW viewtest AS
SELECT a FROM viewtest_tbl WHERE a <> 20;
! ERROR: cannot drop columns from view
-- should fail
CREATE OR REPLACE VIEW viewtest AS
SELECT 1, * FROM viewtest_tbl;
! ERROR: column "b" of relation "viewtest" already exists
-- should fail
CREATE OR REPLACE VIEW viewtest AS
SELECT a, b::numeric FROM viewtest_tbl;
ERROR: cannot change data type of view column "b"
+ -- should work
+ CREATE OR REPLACE VIEW viewtest AS
+ SELECT a, b, 0 AS c FROM viewtest_tbl;
DROP VIEW viewtest;
DROP TABLE viewtest_tbl;
-- tests for temporary views
Index: src/test/regress/sql/create_view.sql
===================================================================
RCS file: /projects/cvsroot/pgsql/src/test/regress/sql/create_view.sql,v
retrieving revision 1.7
diff -c -r1.7 create_view.sql
*** src/test/regress/sql/create_view.sql 7 Apr 2005 01:51:41 -0000 1.7
--- src/test/regress/sql/create_view.sql 7 Aug 2008 11:22:45 -0000
***************
*** 61,66 ****
--- 61,70 ----
CREATE OR REPLACE VIEW viewtest AS
SELECT a, b::numeric FROM viewtest_tbl;

+ -- should work
+ CREATE OR REPLACE VIEW viewtest AS
+ SELECT a, b, 0 AS c FROM viewtest_tbl;
+
DROP VIEW viewtest;
DROP TABLE viewtest_tbl;

Here's a patch that allows CREATE OR REPLACE VIEW to add new columns
to an existing view.

Any feedback would be appreciated, especially if it meant that I could
fix any problems before the next commitfest.

Thanks,

...Robert

Re: [HACKERS] Visibility Groups

On Thu, 2008-08-07 at 12:55 +0200, Jochem van Dieten wrote:
> On Thu, Aug 7, 2008 at 12:38 PM, Simon Riggs wrote:
> > I propose creating "Visibility Groups" that *explicitly* limit the
> > ability of a transaction to access data outside its visibility group(s).
>
> Doesn't every transaction need to access data from the catalogs?
> Wouldn't the inclusion of a catalogs visibility group in every
> transaction negate any potential benefits?

True, but I don't see the catalogs as frequently updated data. The
objective is to isolate frequently updated tables from long running
statements that don't need to access them.

Tables can be in multiple visibility groups, perhaps that wasn't clear.
When we seek to vacuum a table, we take the lowest xmin of any group it
was in when we took snapshot.

e.g. Long running statement accesses table L, so must access table L and
catalog tables only. We set this explicitly. Frequently updated table F
is accessed by general transactions that have set no visibility group,
i.e. the implicit group is "all tables".

So catalog and table L would be in in two groups, while F in only one.
As a result, the xmin used for table F will be later than the one used
for table L because the long running statement's transaction is not
included in the calculation of the xmin for table F. The transaction
accessing L has explicitly defined the limit of its access, so removing
rows from F is possible without breaking MVCC.

--
Simon Riggs www.2ndQuadrant.com
PostgreSQL Training, Services and Support


--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Re: [GENERAL] looking for psql without server-installation

hallo magnus,

thanks for your answer.

> Just run the "make" and "make install" commands in subdirs
> only. You will need to do it in src/interfaces/libpq and
> src/bin/psql to get a working psql.

that is the answer i was looking for.

> But you can certainly have control over the version on the
> client even if you use binary packages like .RPMs. Just
> decide which version you install. The OS may come with a
> pre-selected version by default, but for most OSes there are
> RPMs or DEBs available for other versions as well that you
> can install.

the available versions are very different for every os, every version of
the os, and so on. so i don't prefer this method but sometimes (or for
other people maybe often) it works

best regards
christian


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[HACKERS] Infrastructure changes for recovery

I would like to propose some changes to the infrastructure for recovery.
These changes are beneficial in themselves, but also form the basis for
other work we might later contemplate.

Currently
* the startup process performs restartpoints during recovery
* the death of the startup process is tied directly to the change of
state in the postmaster following recovery

I propose to
* have startup process signal postmaster when it starts Redo phase (if
it starts it)
* have startup process signal postmaster again when it has completed
recovery, so that the change of state is via explicit signal rather than
death of the child process

Decoupling things in this way allows us to
1. arrange for the bgwriter to start during Redo, so it can:
i) clean dirty blocks for the startup process
ii) perform restartpoints in background
Both of these aspects will increase performance of recovery

2. provide a starting point for other changes in both startup process
and postmaster. These would include
i) have startup process do other work after startup completes, such as
executing transactions to rebuild damaged indexes, etc

ii) have postmaster allow connections while Redo is taking place, as one
part of allowing query access to standby database

The above two points have not been discussed and require separate
justification. However, any work on them is impossible without these
infrastructure changes.

These changes are part of a general strategy of moving in beneficial
steps towards various other goals, rather than attempting to create a
super-patch on 1 Nov that conflicts with other patches incoming at that
time. These parts are likely to conflict with synch replication work, so
I want to resolve as much as possible on Sept Commitfest.

The patch would include the required changes for bgwriter also.

Any objections/alterations to these proposals, please?

--
Simon Riggs www.2ndQuadrant.com
PostgreSQL Training, Services and Support


--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Re: [GENERAL] looking for psql without server-installation

hi tomasz,
thanks for your answers. unfortunately i misworded my problem again. i have a very clear problem and i am looking for a solution of this problem (if it is basic or not) and i am not using RedHatEL/CentOS/Fedora. i am looking for a solution which is applicable to every linux os and not only for some. so here again my problem:

i am looking for the possibility to install a psql client (without a server) FROM THE SOURCE. my usecase is: one server with a postgresql-server (self compiled) and several workstations with psql-clients, also preferred self compiled.
i know that is possible to compile at every workstation the sourcecode of the server to get a psql-client. but the side effect is, that in this case i have a potential server at every workstation and in my opinion that is a very large footprint. i have to compile psql for myself because otherwise (installing binaries with packaging tools) i have no (or minimal) control about the version of the client.
i think that is a use case which can be applied to the needs of many people (for example: oracle offers also client-only-packages which are containing sql+, ...)
regards and please excuse my unclear question
christian
p.s. i don't want to change to RedHatEL/CentOS/Fedora

> -----Ursprüngliche Nachricht-----
> Von: Tomasz Ostrowski [mailto:tometzky@batory.org.pl]
> Gesendet: Donnerstag, 7. August 2008 13:01
> An: Strobl, Christian
> Cc: pgsql-general@postgresql.org
> Betreff: Re: AW: looking for psql without server-installation
>
> On 2008-08-07 11:49, Christian.Strobl@dlr.de wrote:
>
> > maybe i misworded my problem. i am looking for the possibility to
> > install a psql client (without a server) out of the sources.
>
> It is not a basic problem - it is your solution for a
> problem, which maybe does have another, better solution.
>
> > i have to compile psql for myself because otherwise (installing
> > binaries with packaging tools) i have no (or minimal) control about
> > the version of the client.
>
> You can use official yum repository and you'll have total
> control of client version. It works for RedHatEL/CentOS/Fedora:
> http://yum.pgsqlrpms.org/reporpms/repoview/
>
> Regards
> Tometzky
> --
> ...although Eating Honey was a very good thing to do, there
> was a moment just before you began to eat it which was better
> than when you were...
> Winnie the Pooh
>

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[GENERAL] How to get many data at once?

Hi, if I have such a table:

t_ref_id     t_data
--------------------
1             'abc'
2             '321'
1             'ddd'
2             'xyz'
9             '777'
...


I want to get data with a special t_ref_id:

SELECT t_data FROM THETABLE WHERE t_ref_id = '1';

I must use a while loop to extract the data (I'm using PHP):

$rows = array();
while (($row = pgsql_fetch_assoc($result) !== false) {
    $rows[] = $row;
}

And if there are many matched rows, such as many hundreds or thousands of rows, I think such a loop maybe inefficient.

How to do this in a more efficient way?

Thank you!



--
ddh

Re: [GENERAL] looking for psql without server-installation

On 2008-08-07 11:49, Christian.Strobl@dlr.de wrote:

> maybe i misworded my problem. i am looking for the possibility to
> install a psql client (without a server) out of the sources.

It is not a basic problem - it is your solution for a problem, which
maybe does have another, better solution.

> i have to compile psql for myself because otherwise (installing
> binaries with packaging tools) i have no (or minimal) control about
> the version of the client.

You can use official yum repository and you'll have total control of
client version. It works for RedHatEL/CentOS/Fedora:
http://yum.pgsqlrpms.org/reporpms/repoview/

Regards
Tometzky
--
...although Eating Honey was a very good thing to do, there was a
moment just before you began to eat it which was better than when you
were...
Winnie the Pooh

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] looking for psql without server-installation

Christian.Strobl@dlr.de wrote:
> maybe i misworded my problem. i am looking for the possibility to install a psql client (without a server) out of the sources. my usecase is: one server with a postgresql-server (self compiled) and several workstations with psql-clients, also preferred self compiled.
> i know that is possible to compile at every workstation the sourcecode of the server to get a psql-client. but the side effect is, that in this case i have a potential server at every workstation and in my opinion that is a very large footprint. i have to compile psql for myself because otherwise (installing binaries with packaging tools) i have no (or minimal) control about the version of the client.
> i think that is a use case which can be applied to the needs of many people (for example: oracle offers also client-only-packages which are containing sql+, ...)
> hoping for a solution

Just run the "make" and "make install" commands in subdirs only. You
will need to do it in src/interfaces/libpq and src/bin/psql to get a
working psql.

But you can certainly have control over the version on the client even
if you use binary packages like .RPMs. Just decide which version you
install. The OS may come with a pre-selected version by default, but for
most OSes there are RPMs or DEBs available for other versions as well
that you can install.

//Magnus


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Re: [HACKERS] Visibility Groups

On Thu, Aug 7, 2008 at 12:38 PM, Simon Riggs wrote:
> I propose creating "Visibility Groups" that *explicitly* limit the
> ability of a transaction to access data outside its visibility group(s).

Doesn't every transaction need to access data from the catalogs?
Wouldn't the inclusion of a catalogs visibility group in every
transaction negate any potential benefits?


> Once set, any attempt to lock an object outside of a transactions
> defined visibility_groups will result in an error:

Or is this about locking and not about data access?

Jochem

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Re: [PERFORM] Plz Heeeelp! performance settings

dforums wrote:
> vmstat is giving :
> procs -----------memory---------- ---swap-- -----io---- --system--
> ----cpu----
> r b swpd free buff cache si so bi bo in cs us sy
> id wa
> 0 2 1540 47388 41684 7578976 0 0 131 259 0 1 9
> 3 82 7

This system is practically idle. Either you're not measuring it at a
useful time, or there isn't a performance problem.

> > > But
> >> if I use a second machine to replicate the database, I escape this
> >> problem isn't it ?
> > You reduce the chance of a single failure causing disaster.
> Not clear this reply. It's scare me ....

If server A fails, you still have server B. If server A fails so that
replication stops working and you don't notice, server B won't help any
more.

> > What do you mean by "take 6Go per week"? You update/delete that much
> > data? It's growing by that amount each week?
> YES

That wasn't a yes/no question. Please choose one of:
Are you updating 6Go per week?
Are you adding 6Go per week?

> > I'm not sure what "15000 request per 2 minutes and empty it into 10 min"
> > means.
> I insert 15000 datas every 2 min and delete 15000 every 10 min in those
> tables
> >
> > Do you have 7500 requests per minute?
> should be that, But in fact I'm not treating the datas in real time, and
> I buffer the datas and push the data into the database every 2 min
> > Are these updates?
> during the delete the data are aggregated in other tables which make
> updates

OK, so every 2 minutes you run one big query that adds 15000 rows.
Every 10 minutes you run one big query that deletes 15000 rows.

> > To the "temporary storage"?
>
> > What is this "temporary storage" - an ordinary table?
> Yes, I thied to use temporary tables but I never been able to connect
> this tables over 2 different session/connection, seems that is a
> functionnality of postgresql, or a misunderstanding from me.

That's correct - temporary tables are private to a backend (connection).

> > > I'm making some update or select on tables including more than 20
> > > millions of entrance.
> >
> > Again, I'm not sure what this means.
>
> To aggregate the data, I have to check the presence of others
> information that are stores in 2 tables which includes 24 millions of
> entrance.

OK. I assume you're happy with the plans you are getting on these
queries, since you've not provided any information about them.

> > Oh - *important* - which version of PostgreSQL are you running?
> 8.1.11
> > Is an upgrade practical?
> We are working of trying to upgrade to 8.3.3, but we are not yet ready
> for such migration

OK

> > Looking at your postgresql.conf settings:
> >
> > max_connections = 624
> >
> > That's an odd number.
> Now we could decrease this number, it's not so much usefull for now. we
> could decrease is to 350.

I don't believe you've got 350 active connections either. It will be
easier to help if you can provide some useful information.

> > effective_cache_size = 625000
> >
> > That's around 5GB - is that roughly the amount of memory used for
> > caching (what does free -m say for buffers/cache)?
> total used free shared buffers cached
> Mem: 7984 7828 156 0 38 7349
> -/+ buffers/cache: 440 7544
> Swap: 509 1 508

Not far off - free is showing 7349MB cached. You're not running 350
clients there though - you're only using 440MB of RAM.


I don't see anything to show a performance problem from these emails.

--
Richard Huxton
Archonet Ltd

--
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance

[HACKERS] Visibility Groups

Currently, we calculate a single OldestXmin across all snapshots on the
assumption that any transaction might access any table.

I propose creating "Visibility Groups" that *explicitly* limit the
ability of a transaction to access data outside its visibility group(s).
By default, visibility_groups would be NULL, implying potential access
to all tables.

Once set, any attempt to lock an object outside of a transactions
defined visibility_groups will result in an error:
ERROR attempt to lock table outside of visibility group(s): foo
HINT you need to set a different value for visibility_groups
A transaction can only ever reduce or restrict its visibility_groups, it
cannot reset or add visibility groups.

This would give us the ability to explicitly prevent long running
statements from interfering with updates of critical tables, when those
tables are not accessed.

The visibility_groups list would be held on each PGPROC, so that a
snapshot will be able to calculate an xmin for each visibility group.
When checking visibility of rows using HeapTupleSatisfiesVacuum() we
would use the oldest xmin for the visibility group of the table, rather
than the single global value.

If no visibility groups are in use then everything happens just as it
does now, with only a single "if" test in GetSnapshotData() and
HeapTupleSatisfiesVacuum().

Patch would require providing info through to HeapTupleSatisfiesVacuum()
to allow it to resolve the appropriate xmin to use for visibility
checks, since it will have more than one to choose from. Various ways of
doing that.

We might like the visibility group to be set automatically but that
seems like a harder problem. I do not propose to solve that here. This
general idea has been proposed before, but we always get hung up on our
inability to automatically determine the visibility group. Let's just do
this explicitly, so we can get benefit in the cases where we know very
clearly which tables we'll access and more importantly, which we won't.

How do we specify visibility groups? Well various ways, various syntax,
so that is up for discussion and debate. This might be the place the
concept falls down, maybe where it starts having wings.

* SET visibility_groups = table, schema.*
* define visibility groups using a function:
create_visibility_group('name', 'table/schema list')
* specify them via ALTER TABLE etc

This idea is connected somewhat to replication, so floating it now to
see how viable a concept people think this is. I'm floating the idea in
a fairly neutral way in the hope that it leads others to even
better/more workable proposals, possibly now, possibly over the next few
years.

--
Simon Riggs www.2ndQuadrant.com
PostgreSQL Training, Services and Support


--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

[BUGS] BUG #4344: initdb -L timezone directory

The following bug has been logged online:

Bug reference: 4344
Logged by: Domingo Alvarez Duarte
Email address: mingodad@gmail.com
PostgreSQL version: 8.3.3
Operating system: windows
Description: initdb -L timezone directory
Details:

When specifing a non default location for input files to initialize the
database cluster with the "-L" option this option is not transfered to
timezone functions and initdb fail because it tries to find timezone files
in the hardcoded path settings done at compile time
"/usr/local/share/timezone" for example.

I expected initdb to use "-L" value to timezone too and for all other files
that is expected to be on share directory.

--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Re: [ADMIN] Managing connections

C K wrote:
> Thanks for this information. We are migrating our application from
> mysql to postgresql and use MS Access/ODBC for front end.
Mystery explained. Access is notorious for opening a connection for
everything. Visual Basic used to do the same thing. I think the dot net
stuff now uses a connection pool.
> When I tested on windows, PG starts it's new instance for each
> application that uses ODBC to connect.
Remember it's the app that calls for the connection through ODBC.
Postgres simply responds to the call.
> Even we open multiple tables from a single file, it use only one
> instance, but when another application with same username even from
> same machine is started, another PG instance is started. Now we are
> testing for other applications and impact on memory.
>
> Regards,
> CPK
>
>
> On Thu, Aug 7, 2008 at 3:09 PM, H. Hall <hhall1001@reedyriver.com
> <mailto:hhall1001@reedyriver.com>> wrote:
>
> C K wrote:
>
> Dear Friends,
> I want to know if I open a table to view the data a new
> connection is opened. If I open another table/execute a query
> does a another new connection is opened? As per manual, I know
> that for a database cluster and the same port a postgresql
> instance runs. But if we run multiple SQL statements from same
> client machine with same username, does postgresql creates a
> new instance?
>
> How can connections to the db are handled is determined by the
> application program that accesses the database. Some application
> programs create a connection for each user and re-use it each time
> the user accesses the database. The app is also responsible for
> closing the connection when the user signs off.
>
> Other apps create a pool of connections and lease a connection on
> demand to each operation that accesses the db. When the operation
> is complete, the connection is returned to the pool. This is the
> most efficient way to use connections and I would recommend this
> approach for just about any program.
>
> We created our own connection pool program because we wanted a
> connection pool that we could use to access any db and because we
> considered it to be a key technology. It's a good thing that we
> did because we started out using MS SQLServer for our SaaS
> applications and migrated to Postgres. Migration was a breeze.
>
> Postgresql offers a connection pool which I have not used but
> appears to be highly regarded. You can find info about it here:
> http://pgpool.projects.postgresql.org/
>
> Some apps are not well designed and don't close connections or
> un-lease connections when they should. I call this phenomena
> "leaking connections". You can detect this by having everyone sign
> off the application and see how many connections are still open.
>
> Cheers,
> HH
>
> If yes, how to manage memory? (As per my observations,
> normally each postgresql instance takes 5-10 MB. So if we have
> to manage simultenious 1000 connections, it will require
> 1000*5MB=5GB + system memory requirements (approx. 1 GB) =
> total 6 GB (min.) Does this is correct?)
> Please give the details. I am using Win XP Pro with PostgreSQL
> 8.3.
> Thanks
> CPK
>
> --
> Keep your Environment clean and green.
>
> --------------------------------
>
>
>
>
>
> --
> H. Hall
> ReedyRiver Group LLC
> http://www.reedyriver.com
>
>
>
>
> --
> Keep your Environment clean and green.
>
> --------------------------------
>
>
>


--
H. Hall
ReedyRiver Group LLC
http://www.reedyriver.com


--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin

Re: [SQL] How to creat tables using record ID in for loop

Oh, I checked the function. There are some syntax errors. Right code
listed below:

CREATE OR REPLACE FUNCTION cr_tbls_by_staid() RETURNS INTEGER AS
$$
DECLARE
stid INTEGER;
q TEXT;
BEGIN
FOR stid IN SELECT staid FROM mytest LOOP
q:= 'CREATE TABLE "s' || staid || '" (staid varchar(50), val real,
dt date);';
RAISE NOTICE 'query is: %', q; --for debug
EXECUTE q;
END LOOP;
RETURN 1;
END;
$$ LANGUAGE plpgsql;

Also I forget to change first column definition in last CREATE TABLE
query. Edited variant is, for sure:
CREATE TABLE sta_descs (staid INTEGER, val real, dt date) WITHOUT OIDS;

--
Best regards. Yuri.
mailto: yuragal@gmail.com

--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql

Re: [PERFORM] file system and raid performance

Mark Kirkwood schrieb:
> Mark Kirkwood wrote:
>> You are right, it does (I may be recalling performance from my other
>> machine that has a 3Ware card - this was a couple of years ago...)
>> Anyway, I'm thinking for the Hardware raid tests they may need to be
>> specified.
>>
>>
>
> FWIW - of course this somewhat academic given that the single disk xfs
> test failed! I'm puzzled - having a Gentoo system of similar
> configuration (2.6.25-gentoo-r6) and running the fio tests a little
> modified for my config (2 cpu PIII 2G RAM with 4x ATA disks RAID0 and
> all xfs filesystems - I changed sizes of files to 4G and no. processes
> to 4) all tests that failed on Marks HP work on my Supermicro P2TDER +
> Promise TX4000. In fact the performance is pretty reasonable on the
> old girl as well (seq read is 142Mb/s and the random read/write is
> 12.7/12.0 Mb/s).
>
> I certainly would like to see some more info on why the xfs tests were
> failing - as on most systems I've encountered xfs is a great performer.
>
> regards
>
> Mark
>
I can second this, we use XFS on nearly all our database servers, and
never encountered the problems mentioned.


--
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance

Re: [ADMIN] Managing connections

Thanks for this information. We are migrating our application from mysql to postgresql and use MS Access/ODBC for front end. When I tested on windows, PG starts it's new instance for each application that uses ODBC to connect. Even we open multiple tables from a single file, it use only one instance, but when another application with same username even from same machine is started, another PG instance is started. Now we are testing for other applications and impact on memory.

Regards,
CPK


On Thu, Aug 7, 2008 at 3:09 PM, H. Hall <hhall1001@reedyriver.com> wrote:
C K wrote:
Dear Friends,
I want to know if I open a table to view the data a new connection is opened. If I open another table/execute a query does a another new connection is opened? As per manual, I know that for a database cluster and the same port a postgresql instance runs. But if we run multiple SQL statements from same client machine with same username, does postgresql creates a new instance?
How can connections to the db are handled is determined by the application program that accesses the database. Some application programs create a connection for each user and re-use it each time the user accesses the database. The app is also responsible for closing the connection when the user signs off.

Other apps create a pool of connections and lease a connection on demand to each operation that accesses the db. When the operation is complete, the connection is returned to the pool.  This is the most efficient way to use connections and I would recommend this approach for just about any program.

We created our own connection pool program because we wanted a connection pool that we could use to access any db and because we considered it to be a key technology.  It's a good thing that we did because we started out using MS SQLServer for our SaaS applications and migrated to Postgres.  Migration was a breeze.

Postgresql offers a connection pool which I have not used but appears to be highly regarded. You can find info about it here: http://pgpool.projects.postgresql.org/

Some apps are not well designed and don't close connections or un-lease connections when they should. I call this phenomena "leaking connections". You can detect this by having everyone sign off the application and see how many connections are still open.

Cheers,
HH
If yes, how to manage memory? (As per my observations, normally each postgresql instance takes 5-10 MB. So if we have to manage simultenious 1000 connections, it will require 1000*5MB=5GB + system memory requirements (approx. 1 GB) = total 6 GB (min.) Does this is correct?)
Please give the details. I am using Win XP Pro with PostgreSQL 8.3.
Thanks
CPK

--
Keep your Environment clean and green.

--------------------------------





--
H. Hall
ReedyRiver Group LLC
http://www.reedyriver.com




--
Keep your Environment clean and green.

Re: [GENERAL] looking for psql without server-installation

maybe i misworded my problem. i am looking for the possibility to install a psql client (without a server) out of the sources. my usecase is: one server with a postgresql-server (self compiled) and several workstations with psql-clients, also preferred self compiled.
i know that is possible to compile at every workstation the sourcecode of the server to get a psql-client. but the side effect is, that in this case i have a potential server at every workstation and in my opinion that is a very large footprint. i have to compile psql for myself because otherwise (installing binaries with packaging tools) i have no (or minimal) control about the version of the client.
i think that is a use case which can be applied to the needs of many people (for example: oracle offers also client-only-packages which are containing sql+, ...)
hoping for a solution
christian

> -----Ursprüngliche Nachricht-----
> Von: Tomasz Ostrowski [mailto:tometzky@batory.org.pl]
> Gesendet: Donnerstag, 7. August 2008 08:47
> An: Strobl, Christian
> Cc: pgsql-general@postgresql.org
> Betreff: Re: looking for psql without server-installation
>
> On 2008-08-06 17:38, Christian.Strobl@dlr.de wrote:
> > what is the best way to get a psql-client at a linux system without
> > the need of a server.
>
> On Fedora/RedHat/CentOS or other yum based distribution:
> # yum install postgresql
>
> For Debian/Ubuntu or other dpkg based distribution I think it will be:
> # dpkg --install postgresql-client
> But I do not use Debian, so I can be wrong.
>
> It does not have to be the same version as the server, so
> don't compile it yourself.
>
> Regards
> Tometzky
> --
> ...although Eating Honey was a very good thing to do, there
> was a moment just before you began to eat it which was better
> than when you were...
> Winnie the Pooh
>

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Re: [PERFORM] file system and raid performance

Mark Kirkwood wrote:
> You are right, it does (I may be recalling performance from my other
> machine that has a 3Ware card - this was a couple of years ago...)
> Anyway, I'm thinking for the Hardware raid tests they may need to be
> specified.
>
>

FWIW - of course this somewhat academic given that the single disk xfs
test failed! I'm puzzled - having a Gentoo system of similar
configuration (2.6.25-gentoo-r6) and running the fio tests a little
modified for my config (2 cpu PIII 2G RAM with 4x ATA disks RAID0 and
all xfs filesystems - I changed sizes of files to 4G and no. processes
to 4) all tests that failed on Marks HP work on my Supermicro P2TDER +
Promise TX4000. In fact the performance is pretty reasonable on the old
girl as well (seq read is 142Mb/s and the random read/write is 12.7/12.0
Mb/s).

I certainly would like to see some more info on why the xfs tests were
failing - as on most systems I've encountered xfs is a great performer.

regards

Mark

--
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance

Re: [ADMIN] Managing connections

C K wrote:
> Dear Friends,
> I want to know if I open a table to view the data a new connection is
> opened. If I open another table/execute a query does a another new
> connection is opened? As per manual, I know that for a database
> cluster and the same port a postgresql instance runs. But if we run
> multiple SQL statements from same client machine with same username,
> does postgresql creates a new instance?
How can connections to the db are handled is determined by the
application program that accesses the database. Some application
programs create a connection for each user and re-use it each time the
user accesses the database. The app is also responsible for closing the
connection when the user signs off.

Other apps create a pool of connections and lease a connection on demand
to each operation that accesses the db. When the operation is complete,
the connection is returned to the pool. This is the most efficient way
to use connections and I would recommend this approach for just about
any program.

We created our own connection pool program because we wanted a
connection pool that we could use to access any db and because we
considered it to be a key technology. It's a good thing that we did
because we started out using MS SQLServer for our SaaS applications and
migrated to Postgres. Migration was a breeze.

Postgresql offers a connection pool which I have not used but appears to
be highly regarded. You can find info about it here:
http://pgpool.projects.postgresql.org/

Some apps are not well designed and don't close connections or un-lease
connections when they should. I call this phenomena "leaking
connections". You can detect this by having everyone sign off the
application and see how many connections are still open.

Cheers,
HH
> If yes, how to manage memory? (As per my observations, normally each
> postgresql instance takes 5-10 MB. So if we have to manage
> simultenious 1000 connections, it will require 1000*5MB=5GB + system
> memory requirements (approx. 1 GB) = total 6 GB (min.) Does this is
> correct?)
> Please give the details. I am using Win XP Pro with PostgreSQL 8.3.
> Thanks
> CPK
>
> --
> Keep your Environment clean and green.
>
> --------------------------------
>
>
>


--
H. Hall
ReedyRiver Group LLC
http://www.reedyriver.com


--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin

Re: [HACKERS] Parsing of pg_hba.conf and authentication inconsistencies

Stephen Frost wrote:
> * Magnus Hagander (magnus@hagander.net) wrote:
>> Tom Lane wrote:
>>> It isn't, and I seem to recall we've had that scenario play out a couple
>>> times already for postgresql.conf changes. But pg_hba.conf is far more
>>> complex than "variable = value" ...
>> Ok, then I didn't misunderstand that part at least :-)
>>
>> Ah, well. I know that if others don't pipe in on my side of it, I'm
>> implicitly out-voted ;), since I've stated my case by now... Thus, I
>> won't put any time into working on it unless someone does.
>
> Having one doesn't imply we don't have the other. I believe we should
> definitely have both the --check-config (to address Tom's concern, and
> to improve the user experience when doing an /etc/init.d/postgresql
> reload or similar) and the check done in the postmaster and have it only
> update the running config if the config file parsed correctly.

I thought of another issue with this. My "grand plan" includes being
able to do username mapping (per pg_ident.conf) for other authentication
methods than ident. Specifically this would be interesting for all
external methods, like gssapi/sspi/kerberos/ldap. I was originally
planning to allow each row in pg_hba to specify it's own pg_ident.conf
if necessary (so you could map LDAP and GSSAPI differently, for example,
or map two different kerberos realms differently). To be able to load
these, the postmaster would need to know about them, which means it'd
have to parse that data out anyway.

The other way to do that is to simply say that all external mapping will
use pg_ident.conf, and the only thing you can specify on a per-row basis
is "use map: yes or no". This decreases the flexibility, but would not
require the postmaster to do the parsing.

What do people think about these? I know Stephen for example really want
that feature so - would that restriction make it a lot less useful for you?

//Magnus


--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Re: [PERFORM] Plz Heeeelp! performance settings

Richard Huxton a écrit :
> dforum wrote:
>> Tx for your reply.
>>
>> You mean that RAID use fsync method for keeping data's copy.
>
> No, Merlin means PostgreSQL will issue a sync to force WAL to actual
disk.
>
>> So you invite me to desactivate fsync to increase the performance ?
>
> He means you might have to if you can't afford new hardware. Is disk
> activity the problem? Have you looked at the output of "vmstat" to check?
vmstat is giving :
procs -----------memory---------- ---swap-- -----io---- --system--
----cpu----
r b swpd free buff cache si so bi bo in cs us
sy id wa
0 2 1540 47388 41684 7578976 0 0 131 259 0 1 9
3 82 7


>
>> Desactivating fsync. my second disk will not be uptodate,
>
> No - the RAID stuff is happening in the operating-system.
>
> > so if the
>> machine crash, I wont be able to get the server working quickly???
>
> Not "quickly", perhaps not "at all".
Oups
>
> > But
>> if I use a second machine to replicate the database, I escape this
>> problem isn't it ?
> You reduce the chance of a single failure causing disaster.
Not clear this reply. It's scare me ....
>
>> If I understand right, could you tell me how to do desactivate fsync
>> please ?
>
> There's an "fsync = on" setting in your postgresql.conf, but don't
> change it yet.
OK
>
> > I have a database of 38Go and take 6Go per week.
>
> What do you mean by "take 6Go per week"? You update/delete that much
> data? It's growing by that amount each week?
YES
>
> > I have a lot of update and insert, especially in 8 tables. 2
tables are
> > using for temporary storage, so I right something like 15000
request per
> > 2 minutes and empty it into 10 min.
>
> I'm not sure what "15000 request per 2 minutes and empty it into 10 min"
> means.
I insert 15000 datas every 2 min and delete 15000 every 10 min in those
tables
>
> Do you have 7500 requests per minute?
should be that, But in fact I'm not treating the datas in real time, and
I buffer the datas and push the data into the database every 2 min
> Are these updates?
during the delete the data are aggregated in other tables which make updates
> To the "temporary storage"?

> What is this "temporary storage" - an ordinary table?
Yes, I thied to use temporary tables but I never been able to connect
this tables over 2 different session/connection, seems that is a
functionnality of postgresql, or a misunderstanding from me.
>
> > I'm making some update or select on tables including more than 20
> > millions of entrance.
>
> Again, I'm not sure what this means.

To aggregate the data, I have to check the presence of others
information that are stores in 2 tables which includes 24 millions of
entrance.
>
>
> Oh - *important* - which version of PostgreSQL are you running?
8.1.11
> Is an upgrade practical?
We are working of trying to upgrade to 8.3.3, but we are not yet ready
for such migration
>
>
> Looking at your postgresql.conf settings:
>
> max_connections = 624
>
> That's an odd number.
Now we could decrease this number, it's not so much usefull for now. we
could decrease is to 350.
> Do you usually have that many connections?
> What are they doing? They can't all be active, the machine you've got
> wouldn't cope.
>
> shared_buffers = 250000
> work_mem = 9000
> temp_buffers = 500
>
> These three are important. The shared_buffers are workspace shared
> between all backends, and you've allocated about 2GB. You've also set
> work_mem=9MB, which is how much each backend can use for a single sort.
> That means it can use double or triple that in a complex query

(i now about it).

If
> you're using temporary tables, then you'll want to make sure the
> temp_buffers setting is correct.
I need help for that, I don't know
>
> I can't say whether these figures are good or bad without knowing how
> the database is being used.
>
> effective_cache_size = 625000
>
> That's around 5GB - is that roughly the amount of memory used for
> caching (what does free -m say for buffers/cache)?
total used free shared buffers cached
Mem: 7984 7828 156 0 38 7349
-/+ buffers/cache: 440 7544
Swap: 509 1 508


>
> max_prepared_transactions = 200
>
> Do you use a lot of prepared transactions in two-phase commit?
> I'm guessing that you don't.
I don't
>
> > I'm sure that it could be more optimised. I don't know any thing on
> > WAL,
> > autovacuum, fsm, bgwriter, kernel process, geqo or planner cost
> > settings.
>
> If you run a "vacuum verbose" it will recommend fsm settings at the end
> of its output. I think you probably need to make your autovacuum more
> aggressive, but that's something you'll be able to tell by monitoring
> your database.
>
> It's quite likely that Merlin's right, and you need better hardware to
> cope with the number of updates you're making - that's something where
> you need fast disks. However, he's just guessing because you've not told
> us enough to tell where the problem really lies.
>

Hope that new information will give you more information to help me.

Regards

david

--
<http://www.1st-affiliation.fr>

*David Bigand
*Président Directeur Générale*
*51 chemin des moulins
73000 CHAMBERY - FRANCE

Web : htttp://www.1st-affiliation.fr
Email : david@1st-affiliation.com
Tel. : +33 479 696 685
Mob. : +33 666 583 836
Skype : firstaffiliation_support


--
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance

[PERFORM] Filesystem setup on new system

Hi list,


I'm helping a customer with their new postgresql server and have some
questions.

The servers is connected to a SAN with dual raid cards which all have
512MB cache with BBU.

The configuration they set up is now.
2 SAS 15K drives in RAID 1 on the internal controller for OS.

6 SAS 15K drives in RAID 10 on one of the SAN controllers for database

10 SATA 10K drives in RAID 5 on the second SAN controller for file
storage.

My first idea was to have one partition on the RAID 10 using ext3 with
data=writeback, noatime as mount options.

But I wonder if I should have 2 partitions on the RAID 10 one for the
PGDATA dir using ext3 and one partition for XLOGS using ext2.

Should I do this instead? Is there just a minor speed bump as the
partitions are on the same channel or?

If this is the way to go how should it be configured?

How big should the xlog partition be?

How should the fstab look like for the XLOG partition?

Any other pointers, hints would be appreciated.

Cheers,
Henke


--
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance

Re: [PERFORM] Query Plan choice with timestamps

Giorgio Valoti wrote:
> Hi, I have a timestamptz field that I want to use with a query, but I
> don't need the full timestamp resolution, so I've created a
> day_trunc(timestamptz) immutable function which I'll use with the query
> and with a new index:
>
> logs=> create index test_idx on blackbox (day_trunc(ts));
>
> However, the query plan doesn't use the index:

Does it use it ever? e.g. with
SELECT * FROM blackbox WHERE day_trunk(ts) = '...'

--
Richard Huxton
Archonet Ltd

--
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance

Re: [PERFORM] Plz Heeeelp! performance settings

dforum wrote:
> Tx for your reply.
>
> You mean that RAID use fsync method for keeping data's copy.

No, Merlin means PostgreSQL will issue a sync to force WAL to actual disk.

> So you invite me to desactivate fsync to increase the performance ?

He means you might have to if you can't afford new hardware. Is disk
activity the problem? Have you looked at the output of "vmstat" to check?

> Desactivating fsync. my second disk will not be uptodate,

No - the RAID stuff is happening in the operating-system.

> so if the
> machine crash, I wont be able to get the server working quickly???

Not "quickly", perhaps not "at all".

> But
> if I use a second machine to replicate the database, I escape this
> problem isn't it ?

You reduce the chance of a single failure causing disaster.

> If I understand right, could you tell me how to do desactivate fsync
> please ?

There's an "fsync = on" setting in your postgresql.conf, but don't
change it yet.

> I have a database of 38Go and take 6Go per week.

What do you mean by "take 6Go per week"? You update/delete that much
data? It's growing by that amount each week?

> I have a lot of update and insert, especially in 8 tables. 2 tables are
> using for temporary storage, so I right something like 15000 request per
> 2 minutes and empty it into 10 min.

I'm not sure what "15000 request per 2 minutes and empty it into 10 min"
means.

Do you have 7500 requests per minute?
Are these updates?
To the "temporary storage"?
What is this "temporary storage" - an ordinary table?

> I'm making some update or select on tables including more than 20
> millions of entrance.

Again, I'm not sure what this means.


Oh - *important* - which version of PostgreSQL are you running?
Is an upgrade practical?


Looking at your postgresql.conf settings:

max_connections = 624

That's an odd number.
Do you usually have that many connections?
What are they doing? They can't all be active, the machine you've got
wouldn't cope.

shared_buffers = 250000
work_mem = 9000
temp_buffers = 500

These three are important. The shared_buffers are workspace shared
between all backends, and you've allocated about 2GB. You've also set
work_mem=9MB, which is how much each backend can use for a single sort.
That means it can use double or triple that in a complex query. If
you're using temporary tables, then you'll want to make sure the
temp_buffers setting is correct.

I can't say whether these figures are good or bad without knowing how
the database is being used.

effective_cache_size = 625000

That's around 5GB - is that roughly the amount of memory used for
caching (what does free -m say for buffers/cache)?

max_prepared_transactions = 200

Do you use a lot of prepared transactions in two-phase commit?
I'm guessing that you don't.

> I'm sure that it could be more optimised. I don't know any thing on
> WAL,
> autovacuum, fsm, bgwriter, kernel process, geqo or planner cost
> settings.

If you run a "vacuum verbose" it will recommend fsm settings at the end
of its output. I think you probably need to make your autovacuum more
aggressive, but that's something you'll be able to tell by monitoring
your database.

It's quite likely that Merlin's right, and you need better hardware to
cope with the number of updates you're making - that's something where
you need fast disks. However, he's just guessing because you've not told
us enough to tell where the problem really lies.

--
Richard Huxton
Archonet Ltd

--
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance

Re: [HACKERS] Patch: plan invalidation vs stored procedures

> > Changing statement result type is also currently prohibited in
> > StorePreparedStatement. There maybe good reasons for this,
>
> How about "the SQL spec says so"?

Prepare time is often also the time when you bind the result, or more
generally set up the code to handle the result.

Generally I argue, that a mode of operation must exist where a change in
return type throws an error, so the client can readjust to the change.

We are only allowed to silently replan when it is clear that
the caller is agnostic to the change.
e.g. because the caller only accesses explicit columns of the return type/result set,
or does not supply a new parameter with a default, (or because he set some
parameter that tells us he can cope).

Certainly a new prepare must be able to cope with the change though,
which currently does not seem to be the case when an SP calls another
one that was dropped (and recreated)?

Andreas

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

[HACKERS] [PATCH] allow has_table_privilege(..., 'usage') on sequences

*** a/src/backend/utils/adt/acl.c
--- b/src/backend/utils/adt/acl.c
***************
*** 1558,1563 **** convert_table_priv_string(text *priv_type_text)
--- 1558,1568 ----
if (pg_strcasecmp(priv_type, "TRIGGER WITH GRANT OPTION") == 0)
return ACL_GRANT_OPTION_FOR(ACL_TRIGGER);

+ if (pg_strcasecmp(priv_type, "USAGE") == 0)
+ return ACL_USAGE;
+ if (pg_strcasecmp(priv_type, "USAGE WITH GRANT OPTION") == 0)
+ return ACL_GRANT_OPTION_FOR(ACL_USAGE);
+
if (pg_strcasecmp(priv_type, "RULE") == 0)
return 0; /* ignore old RULE privileges */
if (pg_strcasecmp(priv_type, "RULE WITH GRANT OPTION") == 0)
I just noticed, to my dismay, that has_table_privilege() does not allow
me to check for usage privileges on sequences. I suspect this may have
been an oversight. If so, the attached patch fixes it for me.

-- ams

Re: [PERFORM] Unexpectedly Long DELETE Wait

Volkan YAZICI wrote:
> Hi,
>
> Below command has been running since ~700 minutes in one of our
> PostgreSQL servers.
>
> DELETE FROM mugpsreglog
> WHERE NOT EXISTS (SELECT 1
> FROM mueventlog
> WHERE mueventlog.eventlogid = mugpsreglog.eventlogid);
>
> Seq Scan on mugpsreglog (cost=0.00..57184031821394.73 rows=6590986 width=6)
> Filter: (NOT (subplan))
> SubPlan
> -> Seq Scan on mueventlog (cost=0.00..4338048.00 rows=1 width=0)
> Filter: (eventlogid = $0)

Ouch - look at the estimated cost on that!

> And there isn't any constraints (FK/PK), triggers, indexes, etc. on any
> of the tables. (We're in the phase of a migration, many DELETE commands
> similar to above gets executed to relax constraints will be introduced.)

Well there you go. Add an index on eventlogid for mugpsreglog.

Alternatively, if you increased your work_mem that might help. Try SET
work_mem='64MB' (or even higher) before running the explain and see if
it tries a materialize. For situations like this where you're doing big
one-off queries you can afford to increase resource limits.

--
Richard Huxton
Archonet Ltd

--
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance

[ODBC] Should/does SQLForeignKeys work (8.03.02)?

Hi,

I am trying to retrieve the foreign keys of/to a PostgreSQL table
(PostgreSQL ODBC 8.03.02, PostgreSQL 8.3.3, unixodbc 2.2.11) using ODBC.
But whatever I try I do not get any results.

I assume that if I do

SQLForeignKeys(hstmt,
NULL, 0, /* Primary catalog */
NULL, 0, /* Primary schema */
szTable, SQL_NTS, /* Primary table */
NULL, 0, /* Foreign catalog */
NULL, 0, /* Foreign schema */
NULL, 0); /* Foreign table */

I should get all the foreign keys TO this table FROM another table.

Otherwise, doing

SQLForeignKeys(hstmt,
NULL, 0, /* Primary catalog */
NULL, 0, /* Primary schema */
NULL, 0, /* Primary table */
NULL, 0, /* Foreign catalog */
NULL, 0, /* Foreign schema */
szTable, SQL_NTS); /* Foreign table */

should get me all the foreign keys FROM this table TO another table.

BTW: I have tried it with non-null catalogs and schemas also.

Is that correct, and should it work?

TIA

Joost


--
Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc

[PERFORM] Query Plan choice with timestamps

Hi, I have a timestamptz field that I want to use with a query, but I
don't need the full timestamp resolution, so I've created a
day_trunc(timestamptz) immutable function which I'll use with the
query and with a new index:

logs=> create index test_idx on blackbox (day_trunc(ts));

However, the query plan doesn't use the index:

logs=>explain select count(*) from blackbox group by day_trunc(ts)
order by day_trunc(ts);
QUERY PLAN
------------------------------------------------------------------------------------------
GroupAggregate (cost=98431.58..119773.92 rows=74226 width=8)
-> Sort (cost=98431.58..99050.92 rows=247736 width=8)
Sort Key: (day_trunc(ts))
-> Seq Scan on blackbox (cost=0.00..72848.36 rows=247736
width=8)
(4 rows)

while with this index:

logs=>create index test_2_idx on blackbox (ts);

the query plan is the expected one:

logs=>explain select count(*) from blackbox group by ts order by ts;
QUERY PLAN
------------------------------------------------------------------------------------------
GroupAggregate (cost=0.00..19109.66 rows=74226 width=8)
-> Index Scan using test_2_idx on blackbox (cost=0.00..16943.16
rows=247736 width=8)

But I fail to see why. Any hints?

Thank you in advance
--
Giorgio Valoti
--
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance

[GENERAL] Checkpoints writes

Hi guys,

What's the way to count the read/write bytes of the checkpoint process
before 8.3 (no pg_stat_bgwriter view :-[ )
I want to distinguish bytes written by checkpoints and others written by
the background process

thanks
--
Cyril SCETBON

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Re: [PERFORM] Plz Heeeelp! performance settings

Tx for your reply.

You mean that RAID use fsync method for keeping data's copy.

So you invite me to desactivate fsync to increase the performance ?

Desactivating fsync. my second disk will not be uptodate, so if the
machine crash, I wont be able to get the server working quickly??? But
if I use a second machine to replicate the database, I escape this
problem isn't it ?

If I understand right, could you tell me how to do desactivate fsync
please ?

Best regards

David

Merlin Moncure a écrit :
> On Wed, Aug 6, 2008 at 6:12 PM, dforum <dforums@vieonet.com> wrote:
>
>> Hello to all,
>>
>>
>> I have a Linux 2.6.24.2-xxxx-std-ipv4-64 #3 SMP Tue Feb 12 12:27:47 CET 2008
>> x86_64 Intel(R) Xeon(R) CPU X5355 @ 2.66GHz GenuineIntel GNU/Linux
>> with 8Gb of memory. Using sata II disk in RAID 1 (I known that is bad, but
>>
> <snip>
>
> this is likely your problem...with fsync on (as you have it), you will
> be lucky to get a couple of hundred transactions/sec out of the
> database. you are probably just exceeding your operational
> capabilities of the hardware so you probably need to upgrade or turn
> off fsync (which means data corruption in event of hard crash).
>
> merlin
>
>


--
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance

Re: [BUGS] Oder by not working

Heikki Linnakangas wrote:
> Unlike on some systems, in PostgreSQL "ORDER BY 1" means order by the
> constant value "1", not the first column. Try "ORDER BY name".

Oh, that's of course not correct at all. "ORDER BY 1" does indeed mean
order by first column. I don't know what I was thinking,

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs