Re: [GENERAL] Better way to process boolean query result in shell-like situations?

2015-10-29 Thread Martijn van Oosterhout
test that à la: What I do is use grep, for example (off the top of my head): if ! psql -qAt -c "select usename from pg_user" | grep -q USERNAME ; then ... If you're looking for true/false you could grep for t/f. Hope this helps, -- Martijn van Oosterhout http://svana.org/

Re: [GENERAL] Unit tests and foreign key constraints

2015-05-21 Thread Martijn van Oosterhout
gres features like timestamptz calculations and hstore, it's generally way easier to run your unit tests on an actual PostgreSQL database. Otherwise you're going to spend all your time working around the fact that your mock database is not the real thing (and running into bugs in your emula

Re: [GENERAL] Unit tests and foreign key constraints

2015-05-21 Thread Martijn van Oosterhout
t foreign key. Foreign keys aren't deferrable by default, you have to create them that way... Have a nice day, -- Martijn van Oosterhout http://svana.org/kleptog/ > He who writes carelessly confesses thereby at the very outset that he does > not attach much importance to his own

Re: [GENERAL] [HACKERS] optimization join on random value

2015-05-04 Thread Martijn van Oosterhout
84) >Filter: ((customer_id)::double precision = trunc((random() * > 45000::double precision))) > (2 rows) If you look carefully you'll see that the comparison here is done as a "double precision" and so can't use the index. If you say something like: WHERE customer_id =

Re: [GENERAL] Prepared statements with bind parameters for DDL

2015-02-11 Thread Martijn van Oosterhout
27;t need to evaluate any expressions to make this work, but it saves you from any quoting issues. Of course, it gets more complicated if you want to allow cases like: PREPARE get_by_id AS SELECT * FROM IDENTIFIER($1) WHERE id=$2; EXECUTE get_by_id('mytable', 400); But DDL would be

Re: [GENERAL] Alternatives to a unique indexes with NULL

2015-01-18 Thread Martijn van Oosterhout
# create table peter_hicks (id int); > CREATE TABLE > Time: 1,129 ms > test=*# create unique index idx_1 on peter_hicks ((case when id is null > then 'NULL' else '' end)) where id is null; > CREATE INDEX > Time: 14,803 ms Note: COALESCE is probably the better ch

Re: [GENERAL] Surrogate pairs in UTF-8

2015-01-18 Thread Martijn van Oosterhout
led? Sounds odd. Can you provide actual queries showing the problem (and server version). Have a nice day, -- Martijn van Oosterhout http://svana.org/kleptog/ > He who writes carelessly confesses thereby at the very outset that he does > not attach much importance to his own thoughts.

Re: [GENERAL] sslcompression / PGSSLCOMPRESSION not behaving as documented?

2015-01-18 Thread Martijn van Oosterhout
rting compression natively in future protocol versions. It will take a while for TLS 1.3 to be deployed so there's time, but PostgreSQL protocol revisions go at a similar pace. Have a nice day, [1] https://github.com/tlswg/tls13-spec -- Martijn van Oosterhout http://svana.org/klep

Re: [GENERAL] Advice for using integer arrays?

2015-01-07 Thread Martijn van Oosterhout
king at your example, you might be more interested in ranges, see for example: http://www.postgresql.org/docs/9.2/static/rangetypes.html Conceptually they are a bit different and there isn't support for multi-ranges AFAIK but they might be more appropriate. Hope this helps, -- Martijn van O

Re: [GENERAL] Recursive CTE trees + Sorting by votes

2014-08-06 Thread Martijn van Oosterhout
[] as path_parent, array[id] as path, ... ORDER BY vote DESC UNION ALL SELECT cte.path as path_parent, cte.path || comments.id as path, ... JOIN cte ... ORDER BY vote DESC ) SELECT * from cte order by path, votes desc; Hope this helps, -- Martijn van Oosterhout http://svana.org/klept

Re: [GENERAL] Random-looking primary keys in the range 100000..999999

2014-07-05 Thread Martijn van Oosterhout
if necessary. Hope this helps, -- Martijn van Oosterhout http://svana.org/kleptog/ > He who writes carelessly confesses thereby at the very outset that he does > not attach much importance to his own thoughts. -- Arthur Schopenhauer signature.asc Description: Digital signature

Re: [GENERAL] pg_attribute growing extremely

2014-06-05 Thread Martijn van Oosterhout
.6 > 1048580 1249.7 > 1048580 1249.8 > 1048580 1249.9 >4316 1249_fsm > 24 1249_vm > and 5 days later the system had arrived at 102 files Is autovacuum enabled? Are you using a lot of temporary tables? Do you have long running transactions? Have a nice day, -- Martijn van Oos

Re: Fwd: [GENERAL] libpq: indefinite block on poll during network problems

2014-05-30 Thread Martijn van Oosterhout
hink the suggestion is to use those methods to make a PGgetResultWithTimeout() that does what you want. Have a nice day, -- Martijn van Oosterhout http://svana.org/kleptog/ > He who writes carelessly confesses thereby at the very outset that he does > not attach much importance to his own thoughts.

Re: Fwd: [GENERAL] libpq: indefinite block on poll during network problems

2014-05-29 Thread Martijn van Oosterhout
settings do nothing unless the SO_KEEPALIVE option is turned on for the socket. AFAICT libpq does not enable this option, hence they (probably) have no effect. (Discovered after finding processes staying alive for several months because the firewall had lost it's state table at some point).

Re: [GENERAL] new index type with clustering in mind.

2014-05-24 Thread Martijn van Oosterhout
provement. Mind you, hash indexes could get this almost free, except they're not crash safe. Have a nice day, -- Martijn van Oosterhout http://svana.org/kleptog/ > He who writes carelessly confesses thereby at the very outset that he does > not attach much importance to

Re: [GENERAL] encrypting data stored in PostgreSQL

2014-04-09 Thread Martijn van Oosterhout
most modern processors have. Essentially, the processor can encrypt/decrypt data so much faster than the cost of reading/writing to disk, you don't notice the difference. There's surely a difference, but if this means you meet your requirements it's an excellent solution. Have a nice

Re: [GENERAL] Refresh Postgres SSL certs?

2014-04-09 Thread Martijn van Oosterhout
d > be done? No pinning, no caching. Have a nice day, -- Martijn van Oosterhout http://svana.org/kleptog/ > He who writes carelessly confesses thereby at the very outset that he does > not attach much importance to his own thoughts. -- Arthur Schopenhauer signature.asc Description: Digital signature

Re: [GENERAL] Refresh Postgres SSL certs?

2014-04-09 Thread Martijn van Oosterhout
e I'd do with Apache or > Nginx? Have you read the Debian README? /usr/share/doc/postgresql-*/README.Debian.gz It talks about how the certificates are made. It uses the ssl-cert package to make them, there's more docs there. Yes, you can make your own self-signed certs and use them.

Re: [GENERAL] 9.3 debian install setup failure

2014-03-22 Thread Martijn van Oosterhout
houldn't install set up server to be booted on start up ? Check if the server is actually running with ps. Maybe you typoed the config file? Have a nice day, -- Martijn van Oosterhout http://svana.org/kleptog/ > He who writes carelessly confesses thereby at the very outset th

Re: [GENERAL] WAL archive cleanup om master

2014-01-06 Thread Martijn van Oosterhout
On Mon, Jan 06, 2014 at 08:17:37AM -0800, Adrian Klaver wrote: > On 01/06/2014 07:35 AM, Martijn van Oosterhout wrote: > >On Mon, Jan 06, 2014 at 07:16:25AM -0800, Adrian Klaver wrote: > >>On 01/06/2014 03:18 AM, Martijn van Oosterhout wrote: > >>>Hoi, > >>&g

Re: [GENERAL] WAL archive cleanup om master

2014-01-06 Thread Martijn van Oosterhout
On Mon, Jan 06, 2014 at 07:16:25AM -0800, Adrian Klaver wrote: > On 01/06/2014 03:18 AM, Martijn van Oosterhout wrote: > >Hoi, > > > >I've setup a up WAL shipping configuration as described in the wiki. On > >the master I have: > > > >archive_mode

[GENERAL] WAL archive cleanup om master

2014-01-06 Thread Martijn van Oosterhout
again because they are still on the master. I can make a script on the master that deletes files older than an hour, but that will break horribly if the copying breaks for an hour. Is there a smarter way to do this, like having rsync not copy stuff already copied once? Thanks in advance, -- Martijn v

Re: [GENERAL] question on IPC vs TCPIP

2014-01-01 Thread Martijn van Oosterhout
> There is a measurable reduction in elapsed time for my code when I > specify IPC. My code uses: > node.js > https://npmjs.org/package/odbc > db2 In general, in postgres you leave the the hostname blank to specify local IPC. Have a nice day, -- Martijn van Oosterhout htt

Re: [GENERAL] having difficulty with explain analyze output

2013-11-26 Thread Martijn van Oosterhout
The outer plan took 3004851ms to return its first row, and last row also as apparently it matched now rows at all. And if this is the complete plan, it took 1,500 seconds for itself. Hope this helps, -- Martijn van Oosterhout http://svana.org/kleptog/ > He who writes carelessly confesses t

[GENERAL] Changing primary key of large table, with foreign keys, without locking

2013-11-20 Thread Martijn van Oosterhout
ne! # \d events Table "public.events" Column | Type | Modifiers +-+--- a | integer | not null b | integer | not null Indexes: "events_a_b_pkey" PRIMARY KEY, btree (a, b) Referenced by: TABLE "attr1" CONSTRAINT &q

Re: [GENERAL] Postgres as In-Memory Database?

2013-11-17 Thread Martijn van Oosterhout
just not as interesting. Have a nice day, -- Martijn van Oosterhout http://svana.org/kleptog/ > He who writes carelessly confesses thereby at the very outset that he does > not attach much importance to his own thoughts. -- Arthur Schopenhauer signature.asc Description: Digital signature

Re: [GENERAL] Curious question about physical files to store database

2013-11-07 Thread Martijn van Oosterhout
t when I drop a partition I actually see the disk usage drop. Have a nice day, -- Martijn van Oosterhout http://svana.org/kleptog/ > He who writes carelessly confesses thereby at the very outset that he does > not attach much importance to his own thoughts. -- Arthur Schopen

Re: [GENERAL] Suitable Index for my Table

2013-11-04 Thread Martijn van Oosterhout
just put a btree index on every column. Have a nice day, -- Martijn van Oosterhout http://svana.org/kleptog/ > He who writes carelessly confesses thereby at the very outset that he does > not attach much importance to his own thoughts. -- Arthur Schopenhauer signature.asc Description: Digital signature

Re: [GENERAL] Suitable Index for my Table

2013-11-04 Thread Martijn van Oosterhout
ue+radius) ) If you commonly use sets of columns you can go multiple dimensional for extra benefit. Have a nice day, -- Martijn van Oosterhout http://svana.org/kleptog/ > He who writes carelessly confesses thereby at the very outset that he does > not attach much importance to his own thoughts. -- Arthur Schopenhauer signature.asc Description: Digital signature

Re: [HACKERS] [GENERAL] Urgent Help Required

2013-10-08 Thread Martijn van Oosterhout
case it isn't clear to the original poster, VACUUM FULL will take a lot longer than a simple VACUUM and probably not really help much. Just plain VACUUM. Have a nice day, -- Martijn van Oosterhout http://svana.org/kleptog/ > He who writes carelessly confesses thereby at the very outset that he does > not attach much importance to his own thoughts. -- Arthur Schopenhauer signature.asc Description: Digital signature

Re: [GENERAL] Building with MinGW issue

2013-09-29 Thread Martijn van Oosterhout
#x27;s the problem but the system libraries, which are different from every other platform. Have a nice day, -- Martijn van Oosterhout http://svana.org/kleptog/ > He who writes carelessly confesses thereby at the very outset that he does > not attach much importance to his own thoughts. -- Arthur Schopenhauer signature.asc Description: Digital signature

Re: [GENERAL] procedure to contribute this community

2013-04-08 Thread Martijn van Oosterhout
orkarounds at all levels of the stack leading to associated performence problems and instability. Someone wrote a nice blog about it once and coined a term, but I've forgetten what. Have a nice day, -- Martijn van Oosterhout http://svana.org/kleptog/ > He who writes carelessly confesses t

Re: [GENERAL] Why does slony use a cursor? Anyone know?

2013-03-05 Thread Martijn van Oosterhout
ooked like they were missing an index. I asked about it and it turns out that I was running a somewhat old version, and it was fixed in later versions. Check that first. But ask anyway, I've always found the Slony guys very helpful. Have a nice day, -- Martijn van Oosterhout http://

Re: [GENERAL] New Zealand Postgis DBA job vacancy

2012-12-26 Thread Martijn van Oosterhout
e more common ways to get permanent residency, since that is one of the easier ways. I've never heard of anything like the weird cases you get with those American green cards. Have a nice day, -- Martijn van Oosterhout http://svana.org/kleptog/ > He who writes carelessly confess

Re: [GENERAL] integer instead of 'double precision'?

2012-11-12 Thread Martijn van Oosterhout
e modulus operator (%). Python 3 recently changed to give float output by default, but also provides a // operator to access the truncated version. Have a nice day, -- Martijn van Oosterhout http://svana.org/kleptog/ > He who writes carelessly confesses thereby at the very outset that he

Re: [GENERAL] PostgreSQL and IPV6

2012-11-03 Thread Martijn van Oosterhout
e privacy extensions by default, so the IP address doesn't change. Maybe that explains it? Have a nice day, -- Martijn van Oosterhout http://svana.org/kleptog/ > He who writes carelessly confesses thereby at the very outset that he does > not attach much importance to his own thoughts. -- Arthur Schopenhauer signature.asc Description: Digital signature

Re: [GENERAL] Somewhat automated method of cleaning table of corrupt records for pg_dump

2012-10-22 Thread Martijn van Oosterhout
fortunatly Postgres doesn't understand clauses like 'ctid > (page,tuple)' to start scanning at a particular spot in the table. It's not automated, though it might not be hard to do. Hope this helps, -- Martijn van Oosterhout http://svana.org/kleptog/ > He who wr

Re: [GENERAL] pg_typeof equivalent for numeric scale, numeric/timestamp precision?

2012-10-02 Thread Martijn van Oosterhout
rd) there's no way to "encourge" postgres to work it out for you. As for no SQL level functions, you could probably write a function to determine the scale/precision of a given *value*, but not for a whole column. But once you have to string representation of the value you have th

Re: [GENERAL] Thousands of schemas and ANALYZE goes out of memory

2012-10-02 Thread Martijn van Oosterhout
o do. With 220,000 tables I imagine this could add up. Have a nice day, -- Martijn van Oosterhout http://svana.org/kleptog/ > He who writes carelessly confesses thereby at the very outset that he does > not attach much importance to his own thoughts. -- Arthur Schopenhauer signature.asc Description: Digital signature

Re: [GENERAL] Securing .pgpass File?

2012-10-02 Thread Martijn van Oosterhout
machines. Which is controlled by public SSH keys which you can check-in safely. Not super safe, but for read-only accounts for e.g. nagios might be ok. Hope this helps, -- Martijn van Oosterhout http://svana.org/kleptog/ > He who writes carelessly confesses thereby at the very outs

Re: [GENERAL] 9.2 and index only scans

2012-08-28 Thread Martijn van Oosterhout
, counting all the rows in a table is something I never do. The system tables carry estimates which have proved good enough for statistical purposes when I need them. Have a nice day, -- Martijn van Oosterhout http://svana.org/kleptog/ > He who writes carelessly confesses thereby at the ve

Re: [GENERAL] Rules, Windows and ORDER BY

2012-08-24 Thread Martijn van Oosterhout
at' index only checking rows that the bitmap shows are interesting. But I'm not sure if postgres can do that. Anyway, the suggested three column index will match your query in a single lookup and hence be much faster than any of the above suggestions, so if this is a really importan

Re: [GENERAL] Alternatives to very large tables with many performance-killing indicies?

2012-08-23 Thread Martijn van Oosterhout
Index Scan on bar (cost=0.00..4.26 rows=500 width=0) Index Cond: (b = 1) (4 rows) In this case a row update will only update indexes with non-NULL rows, which may cut the overhead considerably. Have a nice day, -- Martijn van Oosterhout http://svana.org/kleptog/ > He who writes carel

Re: [GENERAL] How hard would a "path" operator be to implement in PostgreSQL

2012-08-21 Thread Martijn van Oosterhout
On Tue, Aug 21, 2012 at 09:39:20AM +0800, Craig Ringer wrote: > On 08/21/2012 03:06 AM, Martijn van Oosterhout wrote: > >I'm not sure I have an opinion on pushing ORM features to the database > >layer, SQLAlchemy is doing a pretty good job for me already. > > There

Re: [GENERAL] How hard would a "path" operator be to implement in PostgreSQL

2012-08-20 Thread Martijn van Oosterhout
foreign key, but can be by a general join condition. A simple example might be "items in an order" which you could derive from a foreign key, compared to "items in an order which have sales tax" which is something more general. So whatever the result of this discussion, don&#

Re: [GENERAL] How to analyze load average ?

2012-08-06 Thread Martijn van Oosterhout
even things like it taking a while for your disk cache to reach steady state after a reboot can mean that you see a higher than normal load for a while. But 0.88 is really nothing to worry about. Perhaps it is just slower core or a slower memory bus. Have a nice day, -- Martijn van Oosterho

Re: [GENERAL] Libpq question

2012-05-20 Thread Martijn van Oosterhout
e Java lib being the major one. There are pure perl/python implementations but AFAIK they are not widely used. It's not common to not use libpq. Have a nice day, -- Martijn van Oosterhout http://svana.org/kleptog/ > He who writes carelessly confesses thereby at the very outset that h

Re: [GENERAL] Locking or Something Else?

2012-05-20 Thread Martijn van Oosterhout
y are triggered on inserts. If you are wrapping into transactions, then it may be that your disk subsystem has slow fsyncs. Hope this helps, -- Martijn van Oosterhout http://svana.org/kleptog/ > He who writes carelessly confesses thereby at the very outset that he does > not attach muc

Re: [GENERAL] Global Named Prepared Statements

2012-05-14 Thread Martijn van Oosterhout
create a function which has the desired effect? This is a well understood and commonly used paradigm. When using a connection pooler any query plan caching will happen automatically. Have a nice day, -- Martijn van Oosterhout http://svana.org/kleptog/ > He who writes carelessly confes

Re: [GENERAL] pqlib garbage collection

2012-05-03 Thread Martijn van Oosterhout
q, the C library). There is no magic garbage collection. You must use PQclear. Have a nice day, -- Martijn van Oosterhout http://svana.org/kleptog/ > He who writes carelessly confesses thereby at the very outset that he does > not attach much importance to his own thoughts. -- Arth

Re: [GENERAL] SQLSTATE XX000 Internal Error 7

2012-05-03 Thread Martijn van Oosterhout
t, it's not clear how this error can occur. Linux does it if you ask for O_DIRECT on a filesystem that doesn't support it, but it doesn't look like that's the problem here either. Have a nice day, -- Martijn van Oosterhout http://svana.org/kleptog/ > He who writes careless

Re: [GENERAL] Updates, ShareLocks, RowExclusiveLocks, and deadlocks

2012-04-25 Thread Martijn van Oosterhout
ed to this table. Updating a row locks it against other updates, because the second update needs to know which version of the row it's updating. Hope this helps, -- Martijn van Oosterhout http://svana.org/kleptog/ > He who writes carelessly confesses thereby at the very outset that he does > not attach much importance to his own thoughts. -- Arthur Schopenhauer signature.asc Description: Digital signature

Re: [GENERAL] Large Databases redux

2012-03-21 Thread Martijn van Oosterhout
gt; disks and putting everything on it, maybe in different file systems > to seperate out file fragmentation. this way the IO workload is > evenly distributed across all the disks. That, and a good RAID controller with BBU cache will go a long way to relieving the pain of fsync. Have a nice da

Re: [GENERAL] Interesting article, Facebook woes using MySQL

2012-03-14 Thread Martijn van Oosterhout
ATE INDEX CONCURRENTLY, that's *really* annoying. Have a nice day, -- Martijn van Oosterhout http://svana.org/kleptog/ > He who writes carelessly confesses thereby at the very outset that he does > not attach much importance to his own thoughts. -- Arthur Schopenhauer signature.asc Description: Digital signature

Re: [GENERAL] pg_dump -s dumps data?!

2012-01-31 Thread Martijn van Oosterhout
default. Just throwing out some completely different ideas. Have a nice day, -- Martijn van Oosterhout http://svana.org/kleptog/ > He who writes carelessly confesses thereby at the very outset that he does > not attach much importance to his own thoughts. -- Arthur Schopenhauer signature.asc Description: Digital signature

Re: [GENERAL] Strange problem with create table as select * from table;

2011-11-05 Thread Martijn van Oosterhout
gt; of code. Penny wise, pound foolish :-( No doubt the assumption was true when the code was written, but still. Hve a nice day, -- Martijn van Oosterhout http://svana.org/kleptog/ > He who writes carelessly confesses thereby at the very outset that he does > not attach muc

Re: [GENERAL] select where not exists returning multiple rows?

2011-11-02 Thread Martijn van Oosterhout
the "select where not exists" is somehow returning multiple > rows. > Any ideas what's going on here? As pointed out by others, you don't say if it this is a race condition between processes or if it always does this. Have a nice day, -- Martijn van Oosterhout htt

Re: [GENERAL] PostGIS in a commercial project

2011-10-27 Thread Martijn van Oosterhout
breadline is one of those borderline cases). I note in the OPs case they are relying on the customer to install PostGIS. The GPL only applies to *redistribution* not usage. So if you're not supplying your customers with PostGIS then the fact that it's GPL seems completely irrelevent. H

Re: [GENERAL] Video of Activity on PostgreSQL GIT repository

2011-10-17 Thread Martijn van Oosterhout
d at the code turnover rate in postgres, it's really a very active project. > [1] http://www.youtube.com/watch?v=gzTBJW2EVJY > [2] code.google.com/???p/???gource/ > [3] github.com/???postgres/???postgres Have a nice day, -- Martijn van Oosterhout http://svana.org/kleptog/ > He

Re: [GENERAL] (another ;-)) PostgreSQL-derived project ...

2011-09-25 Thread Martijn van Oosterhout
e-8.3beta2.tar.bz2 Notwithstanding the rest of your post, I'm surpised you missed the website: http://www.postgresql.org/download/ There's a source code link, as well as several others. Have a nice day, -- Martijn van Oosterhout http://svana.org/kleptog/ > He who writes carelessly confe

Re: [GENERAL] Parameterized prepared statements

2011-09-04 Thread Martijn van Oosterhout
be turned into hash lookups, but I'm not sure. Try a query with 10,000 element in an IN and see what happens. Have a nice day, -- Martijn van Oosterhout http://svana.org/kleptog/ > He who writes carelessly confesses thereby at the very outset that he does > not attach much importance

Re: [GENERAL] Selecting all records which are in upper case

2011-08-27 Thread Martijn van Oosterhout
pper > case. For example, if the test data is as follows: Might not work if you have non-ascii characters (but your example code breaks there too), but what about: DELETE ... WHERE upper(name) = name; Have a nice day, -- Martijn van Oosterhout http://svana.org/kleptog/ > He who writ

Re: [GENERAL] Getting value of bind variables

2011-08-23 Thread Martijn van Oosterhout
har in place of the parameter. Have a nice day, -- Martijn van Oosterhout http://svana.org/kleptog/ > He who writes carelessly confesses thereby at the very outset that he does > not attach much importance to his own thoughts. -- Arthur Schopenhauer signature.asc Description: Digital signature

Re: [GENERAL] string comparison problem

2011-08-01 Thread Martijn van Oosterhout
chitecture should not be a problem - I have another 64 > bit CentOS where both queries are executed displaying identical results. It's probably locale related. Postgres uses the same order as the "sort" command. Try "show lc_collate". Hope this helps, -- Martijn va

Re: [GENERAL] Referencing function value inside CASE..WHEN

2011-06-19 Thread Martijn van Oosterhout
u almost had it right, there is another syntax for CASE: CASE MY_FUNCTION(...) WHEN 'foo' THEN ... WHEN 'bar' THEN ... ELSE ... END; http://www.postgresql.org/docs/8.4/static/functions-conditional.html Have a nice day, -- Martijn van Oosterhout http://svana.org/klept

Re: [GENERAL] Short-circuit boolean evaluation

2011-04-30 Thread Martijn van Oosterhout
ort circuiting either. This applies to any SQL database. You can somewhat enforce order with subselects and CASE and other such constructs. Have a nice day, -- Martijn van Oosterhout http://svana.org/kleptog/ > Patriotism is when love of your own people comes first; nationalism, > whe

Re: [GENERAL] Huge spikes in number of connections doing "PARSE"

2011-03-14 Thread Martijn van Oosterhout
evious findings with ps/wchan. It's unfortunate you don't have debug symbols enabled, which makes these traces somewhat unreliable. So you get odd things like index_open calling index_close. The common factor seems to be lots of index locks. Do you have very many indexes? Have a

Re: [GENERAL] Why count(*) doest use index?

2011-03-06 Thread Martijn van Oosterhout
r indexes though. Have a nice day, -- Martijn van Oosterhout http://svana.org/kleptog/ > Patriotism is when love of your own people comes first; nationalism, > when hate for people other than your own comes first. > - Charles de Gaulle signature.asc Description: Digital signature

Re: [GENERAL] updating all records of a table

2011-03-05 Thread Martijn van Oosterhout
On Sat, Mar 05, 2011 at 07:38:23AM -0800, ray wrote: > This has been a great thread! I am missing something because I do not > know what CTAS is. WOuld someone please help me understand. Create Table As Select. Have a nice day, -- Martijn van Oosterhout http://svana.org/k

Re: [GENERAL] Thoroughly confused about time zones

2011-02-28 Thread Martijn van Oosterhout
me point. This is the timestamp without time zone. The latter is usually not that useful, except for output. What you usually want is the timestamptz. Hop this helps, -- Martijn van Oosterhout http://svana.org/kleptog/ > Patriotism is when love of your own people comes first; nationalism

Re: [GENERAL] PostgreSQL 9.0.3 - collate/ctype order by hu_HU.UTF8 is not correct sorting

2011-02-06 Thread Martijn van Oosterhout
greSQL team? Last I checked *BSD did not support sorting in UTF-8. I know Apple added it themselves because they needed it but I don't think it got backported to *BSD. Have a nice day, -- Martijn van Oosterhout http://svana.org/kleptog/ > Patriotism is when love of your own people c

Re: [GENERAL] Database Design Question

2011-02-02 Thread Martijn van Oosterhout
e different users you can easily do it by setting the default search path per user. ALTER USER phpbb SET search_path='phpbbschema'; As long as the apps don't play with the search path themselves it should be fine. Have a nice day, -- Martijn van Oosterhout http://svana.org/k

Re: [GENERAL] error while trying to change the database encoding on a database

2011-01-24 Thread Martijn van Oosterhout
our code to only output correct encoded data. The suggestion to simply reload the database as if all the current data was WIN1251 or Latin-9 is a fairly easy way to getting the database into a reasonable format. The data would have to be checked though. Have a nice day, -- Martijn van Oosterhou

Re: [GENERAL] Feature request for this mail list

2010-11-02 Thread Martijn van Oosterhout
a mobile client it can be tricky > without + even from a bigger client most often I forgot The mailing list manager has several options which may be relevent here. There is a reply-to option which may do what you want: http://mail.postgresql.org/mj/mj_wwwusr/domain=postgresql.org Have a

Re: [GENERAL] Implementing replace function

2010-11-02 Thread Martijn van Oosterhout
ques. You could track what happened the last two times and use that to predict which would be better. There's always pathelogical cases, but it could work well for normal workloads. Have a nice day, -- Martijn van Oosterhout http://svana.org/kleptog/ > Patriotism is when love of your o

[GENERAL] gitweb error?

2010-10-30 Thread Martijn van Oosterhout
=e6721c6e1617a0fc8b4bce8eacba8b5a381f1f21 Line Number 53, Column 4: Try to  ... ^ Is it just my browser being pedantic (Firefox 3.6) or something else? Have a nice day, -- Martijn van Oosterhout http://svana.org/kleptog/ > Patriotism is when love of your own people comes first; nationalism, > whe

Re: [GENERAL] Record Separator with psql -c when output to a variable not a file!

2010-10-04 Thread Martijn van Oosterhout
lts! If you want a particular column, select only that column instead of "SELECT *". Have a nice day, -- Martijn van Oosterhout http://svana.org/kleptog/ > Patriotism is when love of your own people comes first; nationalism, > when hate for people other than your own comes first.

Re: [GENERAL] Incrementally Updated Backups

2010-09-12 Thread Martijn van Oosterhout
WAL, which ensure that changes are logged consistantly and replays them if the database crashes. If you take a snapshot the database will simply startup and replay the log as if the machine crashed at the point. All committed transactions appears anything uncommitted vanishes. Have a nice day, --

Re: [GENERAL] postgres.conf settings

2010-08-29 Thread Martijn van Oosterhout
tes, or is it read only? - Lots of simple queries, or fewer but more complex queries? Basically, what's the workload? Have a nice day, -- Martijn van Oosterhout http://svana.org/kleptog/ > Patriotism is when love of your own people comes first; nationalism, >

Re: [GENERAL] C-Functions using SPI - Missing Magic Block

2010-07-03 Thread Martijn van Oosterhout
not compatable with th eversion of postgresql installed. Have a nice day, -- Martijn van Oosterhout http://svana.org/kleptog/ > Patriotism is when love of your own people comes first; nationalism, > when hate for people other than your own comes first. >

Re: [GENERAL] checkpoint spikes

2010-06-11 Thread Martijn van Oosterhout
heck if there is stuff to write out. I have found that reducing this tends to smooth out bursty spikes. However, see: http://www.westnet.com/~gsmith/content/linux-pdflush.htm which indicates that kernel may try to defeat you here... Have a nice day, -- Martijn van Oosterhout http://svan

Re: [GENERAL] Persistence problem

2010-05-13 Thread Martijn van Oosterhout
quot; part of a varlena type is not always 4 bytes. Make sure you have fully understood this page: http://www.postgresql.org/docs/8.4/static/xfunc-c.html it has a number of examples dealing with variable length types. You MUST use the VARDATA/VARATT/etc macros to construct and read your data. Hop

Re: [GENERAL] Persistence problem

2010-05-12 Thread Martijn van Oosterhout
esult = (mytype *)palloc(mytype->length); > mempcy (realResult, result, result->length); Did you define the type properly at SQL level? Is it a varlena type or fixed length? Did you return it properly (as Datum)? You're going to need to post more information before we can help you usefu

Re: [GENERAL] When is an explicit cast necessary?

2010-04-10 Thread Martijn van Oosterhout
mallint. If however you wrote the literal as '1' (with quotes) postgres would happily downcast it for you without any problem. The question is: does the column really need to be smallint. Have a nice day, -- Martijn van Oosterhout http://svana.org/kleptog/ > Patriotism is when

Re: [GENERAL] Internal PG functions, how to pass proper parameters?

2010-04-07 Thread Martijn van Oosterhout
but failed. If it's possible, what would be a working > example? "internal" usually means a "pointer to something you can't make from SQL". So you might be able to declare the function, but in no way could you actually call it successfully. Have a nice day, -- Martijn v

Re: [GENERAL] Yikes: ERROR: out of memory

2010-03-15 Thread Martijn van Oosterhout
shBatchContext 20192792 total in 36 blocks; 7649816 free (29 > chunks); 212542976 used >TupleSort: 369090584 total in 46 blocks; 7648 free (25 chunks); > 369082936 used That's a few hundred MB also. I'd suggest checking your work_mem settings to see if you havn't go

Re: [GENERAL] DROP column: documentation unclear

2010-03-08 Thread Martijn van Oosterhout
> column anymore - I'm not quite sure how to interpret this. What is pg > doing? What you're missing is that in postgres NULLs are stored as a bit in the header and there is no data. So in a sense NULLs take no space (well, one bit) which means both statements are true. Have a ni

[GENERAL] timestamp literal out of line

2010-03-07 Thread Martijn van Oosterhout
at or near "$1" The workaround is simple, use a cast instead, but is there a particular reason why you can't use a parameter there? This does work, oddly enough. postgres=# prepare test2 as select timestamp '2009-01-01' at time zone $1; PREPARE Have a nice day, -

Re: [GENERAL] Putting index entries to XLog

2010-02-28 Thread Martijn van Oosterhout
epend on this action. > I hope that somebody will be able to help me according to this issue. > Thanks in advance > > Best regards > Carsten Kropf > -- > Sent via pgsql-general mailing list (pgsql-general@postgresql.org) > To make changes to your subscription: > http://w

Re: [GENERAL] Performance comparison

2010-02-25 Thread Martijn van Oosterhout
On Wed, Feb 24, 2010 at 09:13:36PM -0500, Greg Smith wrote: > Martijn van Oosterhout wrote: >> I remember a while back someone posted a graphs showing a scalability >> of postgresql for various versions (I think 8.0 to 8.4). I've tried to >> find this image again but hav

[GENERAL] Performance comparison

2010-02-24 Thread Martijn van Oosterhout
Hoi, I remember a while back someone posted a graphs showing a scalability of postgresql for various versions (I think 8.0 to 8.4). I've tried to find this image again but havn't been able to locate it. Does anyone here remember? Mvg, -- Martijn van Oosterhout http://svana.o

Re: [GENERAL] Week numbers and calculating weekly statistics/diagrams

2010-02-16 Thread Martijn van Oosterhout
7;s going to be a bottleneck. Have a nice day, -- Martijn van Oosterhout http://svana.org/kleptog/ > Please line up in a tree and maintain the heap invariant while > boarding. Thank you for flying nlogn airlines. signature.asc Description: Digital signature

Re: [GENERAL] Memory Usage and OpenBSD

2010-02-09 Thread Martijn van Oosterhout
ries to keep below the values in work_mem and maintainence_workmem. Most of the allocations are quite small, but postgresql has an internal allocator which means that the system only sees relatively large allocations. The majority will be in the order of tens of kilobytes I suspect. Have a nice day, -- Martijn

Re: [GENERAL] Error "invalid byte sequence for encoding UTF8" on insert into BYTEA column

2010-01-21 Thread Martijn van Oosterhout
sn't changed in a long time. And I would have thought you'd be sending your paramters out of line anyway. Can you check that? Hope this helps, -- Martijn van Oosterhout http://svana.org/kleptog/ > Please line up in a tree and maintain the heap invariant while > boardi

Re: [GENERAL] vacuum issues under load?

2010-01-17 Thread Martijn van Oosterhout
e able to get the TRUNCATE command to abort if it takes too long. Have a nice day, -- Martijn van Oosterhout http://svana.org/kleptog/ > Please line up in a tree and maintain the heap invariant while > boarding. Thank you for flying nlogn airlines. signature.asc Description: Digital signature

Re: [GENERAL] Collate order on Mac OS X, text with diacritics in UTF-8

2010-01-17 Thread Martijn van Oosterhout
lgorithms at all at the libc level (that is, if you don't just tell people to use ICU in that case). Mac OS X doesn't have great POSIX locale support but at least they implemented strcoll_l. Have a nice day, -- Martijn van Oosterhout http://svana.org/kleptog/ > Please line up

Re: [GENERAL] Collate order on Mac OS X, text with diacritics in UTF-8

2010-01-13 Thread Martijn van Oosterhout
ith PostgreSQL : Yes, that's the basic idea. Mac OS X apparently provides ICU underneath for programs that would like true unicode collation, but there is little chance that postgresql will ever use this. Hope this helps, -- Martijn van Oosterhout http://svana.org/kleptog/ > Please line

Re: [GENERAL] Question about the ANY operator

2009-12-21 Thread Martijn van Oosterhout
40db76', > '5ee315ea-7ef6-4fa5-809a-dc9931a01ed1']::uuid[]; The syntax is '= ANY(foo)', you're missing the parenthesis. Have a nice day, -- Martijn van Oosterhout http://svana.org/kleptog/ > Please line up in a tree and maintain the heap inv

Re: [GENERAL] Charset Win1250 on Windows and Ubuntu

2009-12-21 Thread Martijn van Oosterhout
ld scripts can work unchanged but newer scripts can choose UTF-8 if they want it. Have a nice day, -- Martijn van Oosterhout http://svana.org/kleptog/ > Please line up in a tree and maintain the heap invariant while > boarding. Thank you for flying nlogn airlines. signature.asc

Re: [GENERAL] PlPerl scope issue

2009-12-16 Thread Martijn van Oosterhout
er doesn't have the problem you're running into. sub main { my $test=shift; test(); return $test; sub test { print "X=".$test."\n"; } } main(1); main(2); Output: X=1 X=1 Have a nice day, -- Martijn van Oosterhout http://svana.org/kleptog/

  1   2   3   4   5   6   7   8   9   10   >