[PATCHES] GIN vs. statistics collector

2006-08-02 Thread Andreas Seltenreich
I think there's a call to pgstat_count_index_scan missing in GIN.
Currently, the idx_scan column of pg_stat_*_indexes is stuck at zero
for GIN indexes.

Patch attached.

Thanks,
andreas
Index: src/backend/access/gin/ginscan.c
===
RCS file: /projects/cvsroot/pgsql/src/backend/access/gin/ginscan.c,v
retrieving revision 1.3
diff -c -r1.3 ginscan.c
*** src/backend/access/gin/ginscan.c	14 Jul 2006 14:52:16 -	1.3
--- src/backend/access/gin/ginscan.c	2 Aug 2006 23:07:30 -
***
*** 15,20 
--- 15,21 
  #include postgres.h
  #include access/genam.h
  #include access/gin.h
+ #include pgstat.h
  #include utils/memutils.h
  
  
***
*** 155,160 
--- 156,163 
  
  	if ( so-nkeys == 0 )
  		elog(ERROR, Gin doesn't support full scan due to it's awful inefficiency);
+ 
+ 	pgstat_count_index_scan(scan-xs_pgstat_info);
  }
  
  Datum

---(end of broadcast)---
TIP 6: explain analyze is your friend


Re: [PATCHES] Restartable Recovery

2006-07-16 Thread Andreas Seltenreich
Simon Riggs [EMAIL PROTECTED] writes:

 [2. text/x-patch; restartableRecovery.patch]

Hmm, wouldn't you have to reboot the resource managers at each
checkpoint? I'm afraid otherwise things like postponed page splits
could get lost on restart from a later checkpoint.

regards,
andreas

---(end of broadcast)---
TIP 9: In versions below 8.0, the planner will ignore your desire to
   choose an index scan if your joining column's datatypes do not
   match


Re: [PATCHES] TODO item -- Improve psql's handling of multi-line queries

2005-12-07 Thread Andreas Seltenreich
Sergey E. Koposov schrob:

 I submit the new version of my patch (against the CVS tip), correcting the 
 problem with \edit (pointed by Andreas). So now everything works fine.

I think there's a pgflush_history() call missing somewhere, since the
buffer isn't flushed on a control-c. The fresh query is appended to
the aborted one in the history:

--8---cut here---start-8---
nnpg=# select  
nnpg-#   something_i_would_rather_not_submit_yet
nnpg-# -- control-c
nnpg=# select 1;
 ?column? 
--
1
(1 row)

nnpg=# -- control-p will now yield the following history entry
nnpg=# select
  something_i_would_rather_not_submit_yet
select 1;
--8---cut here---end---8---

Some more comments:

Wouldn't it be more elegant to use the facilities in libpq's
pqexpbuffer.h for the history buffer instead of passing the
buffer-length around as a separate function argument and doing custom
string operations?

The multi-line history entries are not preserved between psql
invocations. Bash does solve this by folding multi-line commands into
a single line where possible. But I have to admit, this could be sold
as another TODO item :-)

regards,
Andreas

---(end of broadcast)---
TIP 5: don't forget to increase your free space map settings


Re: [PATCHES] TODO item -- Improve psql's handling of multi-line queries

2005-12-02 Thread Andreas Seltenreich
Bruce Momjian writes:

 Where are we on this patch?  Was it submitted?  Applied?  Just an
 idea?

| This has been saved for the 8.2 release:
| 
|   http://momjian.postgresql.org/cgi-bin/pgpatches_hold

I tested it with 8.1RC1 and noticed the inconsistency with the \edit
command. I guess one would at least need to change do_edit to modify
the newly introduced history_buffer instead of the history itself.

But I'm not sure why there is a need for a history_buffer at all,
couldn't one use the query_buffer instead? (Sergey?)

regards,
Andreas
-- 

---(end of broadcast)---
TIP 9: In versions below 8.0, the planner will ignore your desire to
   choose an index scan if your joining column's datatypes do not
   match


Re: [PATCHES] TODO item -- Improve psql's handling of multi-line queries

2005-11-15 Thread Andreas Seltenreich
Sergey E. Koposov writes:

 I'm proposing the small patch for the TODO item -- Improve psql's handling 
 of multi-line queries. With this patch the multi-line queries are saved 
 by readline as whole and not line by line.

I like it already!

 This is my first patch for Postgres but it seems to work and to not break 
 anything.

 I'm waiting for review, comments, objections, etc...

Did you consider its interaction with \e? Editing the query_buffer
with \e will leave that query prefixed with \e in the history. That
wasn't the case before your patch.

Also, using \e several times on a query without sending it (i.e.
without a semicolon) will yield a history entry of a concatenation of
old query buffers.

Thanks,
Andreas

---(end of broadcast)---
TIP 4: Have you searched our list archives?

   http://archives.postgresql.org


[PATCHES] typo in psql-ref

2005-10-29 Thread Andreas Seltenreich

I haven't found anything about saveponds in the release notes, so I
guess this is a typo :-)

Index: doc/src/sgml/ref/psql-ref.sgml
===
RCS file: /projects/cvsroot/pgsql/doc/src/sgml/ref/psql-ref.sgml,v
retrieving revision 1.151
diff -u -r1.151 psql-ref.sgml
--- doc/src/sgml/ref/psql-ref.sgml	28 Oct 2005 02:39:07 -	1.151
+++ doc/src/sgml/ref/psql-ref.sgml	30 Oct 2005 01:20:27 -
@@ -2107,7 +2107,7 @@
 files. When literaloff/ (the default), a statement in a
 transaction block that generates an error aborts the entire
 transaction. The on_error_rollback-on mode works by issuing an
-implicit commandSAVEPONT/ for you, just before each command
+implicit commandSAVEPOINT/ for you, just before each command
 that is in a transaction block, and rolls back to the savepoint
 on error.
 /para

---(end of broadcast)---
TIP 9: In versions below 8.0, the planner will ignore your desire to
   choose an index scan if your joining column's datatypes do not
   match


[PATCHES] psql: customizable readline history filename

2004-10-26 Thread Andreas Seltenreich
Hi,

the following patch makes the filename used to store the readline
history customizable through a variable named HISTFILE, analogous to
psql's already implemented HISTCONTROL and HISTSIZE variables, and
bash's HISTFILE-Variable.

The motivation was to be able to get psql to maintain separate
histories for separate databases.  This is now easily achievable
through a line like the following in ~/.psqlrc:

\set HISTFILE ~/.psql_history- :DBNAME

regards,
Andreas

Index: doc/src/sgml/ref/psql-ref.sgml
===
RCS file: /projects/cvsroot/pgsql/doc/src/sgml/ref/psql-ref.sgml,v
retrieving revision 1.123
diff -c -r1.123 psql-ref.sgml
*** doc/src/sgml/ref/psql-ref.sgml  6 Oct 2004 18:39:15 -   1.123
--- doc/src/sgml/ref/psql-ref.sgml  26 Oct 2004 05:57:57 -
***
*** 1973,1978 
--- 1973,2001 
/varlistentry
  
varlistentry
+ termvarnameHISTFILE/varname/term
+ listitem
+ para
+   This variable contains the filename used to save the history.
+ Its default value is filename~/.psql_history/filename.
+ When unset or empty, the command history is not saved upon
+ program termination.  For example, 
+ programlisting
+ \set HISTFILE ~/.psql_history- :DBNAME
+ /programlisting
+ in your filename~/.psqlrc/filename will get psql to
+ maintain a separate history for each database.
+ /para
+ note
+ para
+ This feature was shamelessly plagiarized from
+ applicationBash/application.
+ /para
+ /note
+ /listitem
+   /varlistentry
+ 
+   varlistentry
  termvarnameHISTSIZE/varname/term
  listitem
  para
Index: src/bin/psql/input.c
===
RCS file: /projects/cvsroot/pgsql/src/bin/psql/input.c,v
retrieving revision 1.41
diff -c -r1.41 input.c
*** src/bin/psql/input.c12 Oct 2004 21:54:44 -  1.41
--- src/bin/psql/input.c26 Oct 2004 05:57:57 -
***
*** 38,46 
  static void finishInput(int, void *);
  #endif
  
- #define PSQLHISTORY .psql_history
- 
- 
  #ifdef USE_READLINE
  static enum histcontrol
  GetHistControlConfig(void)
--- 38,43 
***
*** 167,173 
  #ifdef USE_READLINE
if (flags  1)
{
!   charhome[MAXPGPATH];
  
useReadline = true;
initialize_readline();
--- 164,171 
  #ifdef USE_READLINE
if (flags  1)
{
!   const char *psql_history;
!   char   *tilde_expanded;
  
useReadline = true;
initialize_readline();
***
*** 176,191 
if (GetVariable(pset.vars, HISTSIZE) == NULL)
SetVariable(pset.vars, HISTSIZE, 500);
using_history();
-   if (get_home_path(home))
-   {
-   char   *psql_history;
  
!   psql_history = pg_malloc(strlen(home) + 1 +
!
strlen(PSQLHISTORY) + 1);
!   sprintf(psql_history, %s/%s, home, PSQLHISTORY);
!   read_history(psql_history);
!   free(psql_history);
!   }
}
  #endif
  
--- 174,189 
if (GetVariable(pset.vars, HISTSIZE) == NULL)
SetVariable(pset.vars, HISTSIZE, 500);
using_history();
  
!   if (GetVariable(pset.vars, HISTFILE) == NULL)
!   SetVariable(pset.vars, HISTFILE, ~/.psql_history);
! 
!   psql_history = GetVariable(pset.vars, HISTFILE);
! 
!   tilde_expanded = pg_strdup(psql_history);
!   expand_tilde(tilde_expanded);
!   read_history(tilde_expanded);
!   free(tilde_expanded);
}
  #endif
  
***
*** 228,252 
  #ifdef USE_READLINE
if (useHistory)
{
!   charhome[MAXPGPATH];
! 
!   if (get_home_path(home))
!   {
!   char   *psql_history;
!   int hist_size;
  
!   psql_history = pg_malloc(strlen(home) + 1 +
!
strlen(PSQLHISTORY) + 1);
  
!   hist_size = GetVariableNum(pset.vars, HISTSIZE, -1, -1, 
true);
  
!   if (hist_size = 0)
!   stifle_history(hist_size);
! 
!   sprintf(psql_history, %s/%s, home, PSQLHISTORY);
!   write_history(psql_history);
!   free(psql_history);
!   }
}
  #endif
  }
--- 226,251 
  #ifdef USE_READLINE
if 

[PATCHES] Minor psql reference fix

2004-08-14 Thread Andreas Seltenreich
Hi,

I just stumbled across a strange looking sentence in the psql
reference.  I'm not sure if I fixed it correctly, since English isn't
my native language. Patch attached.

Thanks
Andreas

Index: psql-ref.sgml
===
RCS file: /projects/cvsroot/pgsql-server/doc/src/sgml/ref/psql-ref.sgml,v
retrieving revision 1.119
diff -c -r1.119 psql-ref.sgml
*** psql-ref.sgml   15 Jul 2004 03:56:04 -  1.119
--- psql-ref.sgml   13 Aug 2004 23:47:57 -
***
*** 2551,2557 
first argument of a single-letter backslash command to start
directly after the command, without intervening whitespace. For
compatibility this is still supported to some extent,
!   but were are not going to explain the details here as this use is
discouraged.  If you get strange messages, keep this in mind.
For example
  programlisting
--- 2551,2557 
first argument of a single-letter backslash command to start
directly after the command, without intervening whitespace. For
compatibility this is still supported to some extent,
!   but we are not going to explain the details here as this use is
discouraged.  If you get strange messages, keep this in mind.
For example
  programlisting

---(end of broadcast)---
TIP 8: explain analyze is your friend