Re: [GENERAL] Insert query hangs

2014-07-09 Thread Greg Stark
On Wed, Jul 9, 2014 at 11:34 AM, M Tarkeshwar Rao wrote: > > We analysed one more thing when we removed the unique index from the table it > is working fine. > Is there any issue in indexing? > > Is there any option to repair the table or its indexing? REINDEX is useful for indexes. >From the s

Re: [GENERAL] Insert query hangs

2014-07-09 Thread Greg Stark
On Wed, Jul 9, 2014 at 1:25 PM, M Tarkeshwar Rao wrote: > > I am sharing the table structure. When we removed the unique index it is > working fine. > And when created normal index(not unique) it is working fine. > > After removing unique index we tried to recreate it but it is giving > followin

Re: [GENERAL] PostgreSQL's hashing function?

2008-02-22 Thread Greg Stark
Joshua D. Drake wrote: On Fri, 22 Feb 2008 16:49:10 -0500 "Kynn Jones" <[EMAIL PROTECTED]> wrote: Hi! Does PostgreSQL expose its hash function? I need a fast way to hash a string to a short code using characters in the set [A-Za-z0-9_]. Is md5 good enough? :) Probably not. He sai

Re: [GENERAL] How can I look at a recursive table dependency tree?

2009-05-30 Thread Greg Stark
On Fri, May 29, 2009 at 5:10 PM, Emi Lu wrote: > Is it possible to find all view names depend on one table? With 8.4 you can use a query like this (change 'messages' to your table name) This query could stand to be polished a bit though... WITH RECURSIVE tree AS ( SELECT 'messages'::regclass:

Re: [GENERAL] queries on xmin

2009-06-11 Thread Greg Stark
On Thu, Jun 11, 2009 at 11:25 AM, Matt Amos wrote: > > what problems are we going to create for ourselves if we create a > btree index on xmin casted to int4? would it be as efficient to use a > hash index, create a temporary table of txids that we're querying with > a hash index and do an explicit

Re: [GENERAL] When to use cascading deletes?

2009-06-11 Thread Greg Stark
On Thu, Jun 11, 2009 at 9:59 AM, David wrote: > > Ideally, I'd like postgresql to not do cascading deletes, *except* > when I tell it to, and the rest of the time fail when the user didn't > explicitly "opt in" for cascading deletes. When it comes to enabling > cascading deletes, I don't really lik

Re: [GENERAL] queries on xmin

2009-06-11 Thread Greg Stark
On Thu, Jun 11, 2009 at 12:59 PM, Brett Henderson wrote: > I have a couple of hesitations with using this approach: > 1. We can only run the replicator once. > 2. We can only run a single replicator. > 3. It requires write access to the db. > > 1 is perhaps the biggest issue.  It means that we only

Re: [GENERAL] How to store text files in the postgresql?

2009-06-12 Thread Greg Stark
This is a recurring debate and there are pros and cons for both sides. It usually comes down to whether you need transactional guarantees for these large objects. There are also practical concerns. Transfering these large objects over a single database tcp connection limits the application perform

Re: [GENERAL] Custom Fields Database Architecture

2009-06-16 Thread Greg Stark
On Mon, Jun 15, 2009 at 2:04 PM, Gnanam wrote: > > I also read some article which talks about the type of patterns: > 1. Meta-database > 2. Mutating > 3. Fixed > 4. LOB > > My question here is, what is the best approach to define the architecture > for custom fields. Performance should not be compr

Re: [GENERAL] Dynamic table

2009-06-16 Thread Greg Stark
On Tue, Jun 16, 2009 at 12:21 PM, A B wrote: > >> Just had a quick flick through your previous posts; and I'd probably >> stick with the multiple tables approach.  It's the most natural fit to >> relational databases and until you know more about the problem (i.e. >> you've experienced the data you

Re: [GENERAL] Cache lookup failed for type 70385664

2009-06-23 Thread Greg Stark
This looks like data corruption on that record. Or possibly on multiple records. I would: a) update to the latest bug-fix release of 8.2 asap. I don't see any fixed bugs which would cause this specific type of error but there are a lot of them and I could have missed it. http://www.postgresql.o

Re: [GENERAL] after vacuum analyze, explain still wrong

2009-06-23 Thread Greg Stark
Actually most of the estimates seem pretty good. There are some that are a ways off, but the real nasties seem to be these. I'm a bit confused because it looks like two of your joins don't have Join Filters -- and one of those is a left join for which I thought that was impossible. Are you sure th

Re: [GENERAL] [BUGS] Integrity check

2009-06-23 Thread Greg Stark
On Tue, Jun 23, 2009 at 2:00 PM, Dave Page wrote: > On Tue, Jun 23, 2009 at 1:38 PM, David Fetter wrote: >> On Tue, Jun 23, 2009 at 03:38:35PM +0800, Prasad, Venkat wrote: > >>> * do you any tool to check postgreSQL database integrity check? >> >> No more than Oracle does.  We get it right in the f

Re: [GENERAL] Controlling proliferation of postgres.exe processes

2009-06-23 Thread Greg Stark
> In response to Radcon Entec : >> At the current moment, our customer's computer has 22 instances of >> postgres.exe running.  When a colleague checked a few minutes ago, there >> were 29.  Our contract specifies that we cannot consume more than 40% of the >> computer's memory, and we're over t

Re: [GENERAL] Upgrade

2009-06-25 Thread Greg Stark
On Thu, Jun 25, 2009 at 1:28 PM, Guy Flaherty wrote: > One of my servers is still Fedora Core (cough) (cough) 6 :] > It's running Postgresql 8.2.4 > > I want it to serve as a last resort, end of the spectrum, backup/slave > for another server running Postgresql 8.2.9 via Slony-I. Before doing anyt

Re: [GENERAL] [BUGS] Integrity check

2009-06-25 Thread Greg Stark
On Wed, Jun 24, 2009 at 11:45 PM, Scott Mead wrote: > >    If you're asking "Does the database have the ability to verify that > whatever is in a block is what was put into that block", then Oracle has > block check-summing (I'm not sure if this got into PG 8.4 or not...) It didn't, due to technic

Re: [GENERAL] planned recovery from a certain transaction

2009-06-25 Thread Greg Stark
>> The transaction itself works flawlessly, but every once and awhile the data >> the it uploads from comes in flawed and we have to find a way to reset it. If you can automate the tests for the flaws you can do the whole transaction itself as one big transaction in Postgres. Even DDL can be done

Re: [GENERAL] pasting into psql garbles text

2009-06-27 Thread Greg Stark
On Sat, Jun 27, 2009 at 6:19 PM, Merlin Moncure wrote: > I've noticed over a wide variety of operating systems that when you > paste from an application into psql through a terminal (currently > using the default gnome terminal in ubuntu) You should get yourself a real terminal. Even Ubuntu hides

Re: [GENERAL] pasting into psql garbles text

2009-06-27 Thread Greg Stark
On Sat, Jun 27, 2009 at 7:26 PM, Merlin Moncure wrote: > > It doesn't matter the source application...it borks regardless if I > copy from Source insight/wine (my normal editor), gedit, or another > gnome terminal. Are these all gtk apps? Try pasting from an emacs or xterm? -- greg http://mit.ed

Re: [GENERAL] Switching from MySQL: ON DUPLICATE KEY UPDATE, plpgsql function

2009-06-27 Thread Greg Stark
On Sun, Jun 28, 2009 at 2:13 AM, justin wrote: > > if you want to do something like this either do a test first to see if the > key is present in the table, update or do an insert like this > There is no reason to do a loop in the function waiting for a lock to > clear.   Postgresql Locks do not wo

Re: [GENERAL] masking the code

2009-06-29 Thread Greg Stark
On Mon, Jun 29, 2009 at 2:31 PM, Scott Mead wrote: > As with many different types of security (i.e. the 3 foot high fence) this > is really just a deterrent to most people who either aren't capable of > reverse engineering or are just not interested in the first place. Someone I know used to work

Re: [GENERAL]

2009-06-30 Thread Greg Stark
On Tue, Jun 30, 2009 at 9:58 AM, Waldemar Bergstreiser wrote: >> > -- c *= b *= a =* d =* f >> > select * from a, outer( b, outer c), outer (d, outer f ) >> > where a.b_id = b.id and b.c_id = c.id and a.d_id = d.id and d.f_id = f.id; >> >> from a full join b on (a.id=b.id) >> full join c on (b.id=c

Re: [GENERAL] 1 Sequence per Row i.e. each customer's first order starts at 1

2009-07-01 Thread Greg Stark
On Thu, Jul 2, 2009 at 1:04 AM, Merrick wrote: > I would like for each customer > to have orders that start at 1 and move up sequentially. I realize > it's probably not efficient to create a new sequence for each > customer, so am looking for alternate ways to accomplish the same > thing. You coul

Re: [GENERAL] 1 Sequence per Row i.e. each customer's first order starts at 1

2009-07-02 Thread Greg Stark
On Thu, Jul 2, 2009 at 2:46 AM, Merrick wrote: > I was hoping there would be a way to add a field the sequence table > postgresql automatically generates so I could rely on whatever > mechanism postgresql uses to avoid the problems described thus far. Hm, well you could create a sequence for every

Re: [GENERAL] 1 Sequence per Row i.e. each customer's first order starts at 1

2009-07-02 Thread Greg Stark
On Thu, Jul 2, 2009 at 10:35 AM, Scott Marlowe wrote: > Actually, since > you're only incrementing from the highest one, you could just lock the > id from a select max(orderid) where custid=xyz and you'd only have to > lock one row. Not really because you would have a race condition between select

Re: [GENERAL] COALESCE not filtering well.

2009-07-06 Thread Greg Stark
On Mon, Jul 6, 2009 at 6:37 AM, Mohan Raj B wrote: > CREATE OR REPLACE FUNCTION sp_item(itemid integer, itemname character > varying) >   WHERE ( ( COALESCE($1,0)=0 OR  itemid=$1) AND (COALESCE($2, '')='' OR > itemname LIKE '%'||$2||'%') ) LOOP itemid and itemname are your parameters, they're b

Re: [GENERAL] Performance problem with low correlation data

2009-07-06 Thread Greg Stark
On Mon, Jul 6, 2009 at 6:32 PM, Scara Maccai wrote: > The "best" way to read the table would still be a nested loop, but a loop on > the > "t" values, not on the ne_id values, since data for the same timestamp is > "close". But that would be a different query -- there's no restrictions on the

Re: [GENERAL] SELECT DISTINCT very slow

2009-07-09 Thread Greg Stark
On Thu, Jul 9, 2009 at 4:47 PM, Andres Freund wrote: > AFAIK the primary cause is that indexes in pg do not store visibility > information. Not really. The OP doesn't say how wide the record rows are but unless they're very wide it wouldn't pay to use an index for this even if you didn't have to a

Re: [GENERAL] Database storage

2009-07-09 Thread Greg Stark
On Fri, Jul 10, 2009 at 1:28 AM, Scott Marlowe wrote: > > $750 is about what a decent RAID controller would cost you, but again > it's likely that given your bulk import scenario,  you're probably ok > without one.  In this instance, you're probably best off with software > RAID than a cheap RAID c

Re: [GENERAL] SELECT DISTINCT very slow

2009-07-10 Thread Greg Stark
On Fri, Jul 10, 2009 at 1:41 PM, Ben Harper wrote: > > Unfortunately I can't use GROUP BY, because what I'm really doing is > SELECT DISTINCT ON(unique_field) id FROM table; You could do that using GROUP BY if you define a first() aggregate. In this case that would just be SELECT first(id) AS id f

Re: [GENERAL] Overhead of union versus union all

2009-07-10 Thread Greg Stark
On Fri, Jul 10, 2009 at 6:37 PM, Jeff Davis wrote: > > -- foo has a primary key > SELECT * FROM foo UNION SELECT * FROM foo; > > That's logically equivalent to: > > SELECT * FROM foo; > > But postgresql will add a sort anyway. Well no, it's equivalent to SELECT DISTINCT * FROM foo; -- greg htt

Re: [GENERAL] change location of postmaster.pid file?

2009-07-10 Thread Greg Stark
On Fri, Jul 10, 2009 at 11:17 PM, Janet Jacobsen wrote: > Is it possible to create a database cluster on a machine that > has write access to the shared file system, shut down the > Postgres server on that machine, and then start up the > Postgres server on the machine that cannot write to the > sh

Re: [GENERAL] How can I find out the space used on disk for a table/index

2009-07-12 Thread Greg Stark
On Sun, Jul 12, 2009 at 8:45 PM, Andres Freund wrote: > On Sunday 12 July 2009 21:07:56 Viktor Rosenfeld wrote: >> Hi, >> >> I want to judge the performance gain of additional indexes against the >> space they consume on disk.  Currently I do a VACUUM FULL ANALYZE and >> then take the space used by

Re: [GENERAL] Understanding sequential versus index scans.

2009-07-19 Thread Greg Stark
On Sun, Jul 19, 2009 at 11:59 PM, Robert James wrote: > PS Running "PostgreSQL 8.2.1 on i686-pc-mingw32, compiled by GCC gcc.exe > (GCC) 3.4.2 (mingw-special)" > > On Sun, Jul 19, 2009 at 6:58 PM, Robert James > wrote: >> >> Hi.  I notice that when I do a WHERE x, Postgres uses an index, and when

Re: [GENERAL] Understanding sequential versus index scans.

2009-07-20 Thread Greg Stark
On Mon, Jul 20, 2009 at 2:22 PM, Robert James wrote: > BTW, this is interesting, because there are only about 5 or 6 rows max > returned from both queries - but I guess the planner expects more and hence > changes the plan to remove duplicates. If you sent the plans for the various attempts we mi

Re: [GENERAL] Understanding INNER JOIN versus IN subquery

2009-07-20 Thread Greg Stark
On Mon, Jul 20, 2009 at 2:37 PM, Robert James wrote: > I have two queries which should be equivalent.  The Planner plans them > differently, although they are both about the same time.  Can someone > explain why? Uhm, please post the two plans and the server version. I know you've posted them bef

[GENERAL] Re: Row insertion w/ trigger to another table update causes row insertion to _not_ occur

2009-07-21 Thread Greg Stark
On Tue, Jul 21, 2009 at 11:25 PM, Ow Mun Heng wrote: >    RETURN NULL; From the docs: "It can return NULL to skip the operation for the current row." -- http://www.postgresql.org/docs/current/static/trigger-definition.html Just make your trigger return NEW and it won't kill the insert to the chi

Re: [GENERAL] Can LIKE under utf8 use INDEXes?

2009-07-22 Thread Greg Stark
On Wed, Jul 22, 2009 at 5:57 PM, Robert James wrote: > Hi.  I'm confused about the behavior of LIKE under utf8 locale. > Accoding to the docs ( > http://www.postgresql.org/docs/8.2/interactive/locale.html - excerpted > below), it seems that LIKE ignores locale and hence can't use indexes.  Yet, > E

Re: [GENERAL] problem with pg_restore?

2009-07-23 Thread Greg Stark
On Thu, Jul 23, 2009 at 3:14 PM, Sam Mason wrote: > On Thu, Jul 23, 2009 at 07:40:18AM -0600, Scott Marlowe wrote: >> On Tue, Jul 14, 2009 at 5:47 PM, Jim Michaels wrote: >> > could somebody rewrite pg_dumpall and pg_dump so that it makes editable >> > dumps? >> > most programmer's text editors can

Re: [GENERAL] 3des key lengths and key management

2009-07-23 Thread Greg Stark
On Thu, Jul 23, 2009 at 6:11 PM, bulk wrote: > 1)   What are the default 3des key lengths when you load postgresql > enterprise db on a redhat ES x86_64 box? Traditionally 3des can use either 112-bit or 56-bit keys. I think the openssl interface actually lets you set the third key separately now b

[GENERAL] Re: user/grant - best practices handling permission in production system

2009-07-23 Thread Greg Stark
On Thu, Jul 23, 2009 at 10:09 PM, Stefano Nichele wrote: > 2. using the user used in step 1, create the schema and populate tables with > At this point the webapp should work correctly. > The main missing point for me is how to perform step 4 in a simple way since > it seems there is not a way to

Re: [GENERAL] Disable databse listing for non-superuser (\l) ?

2009-07-25 Thread Greg Stark
On Sat, Jul 25, 2009 at 2:53 PM, Andreas Wenk wrote: >> I mean, didn't Apple just kill someone for letting their new iPhone >> design leak? > > this is now going off topic - but what do you mean with your last sentence? Please don't quote an entire message if you're only responding to part of it.

Re: [GENERAL] general question on two-partition table

2009-07-27 Thread Greg Stark
On Tue, Jul 28, 2009 at 1:08 AM, David Wilson wrote: > On Mon, Jul 27, 2009 at 7:52 PM, Janet Jacobsen wrote: > >> Can you suggest other strategies? > > Something that might be easier to play with is to create a (or > several, to speed up other queries) functional index on the comparison > between

Re: [GENERAL] Video available for PGDay SJC '09

2009-07-28 Thread Greg Stark
On Tue, Jul 28, 2009 at 1:41 PM, Andreas Wenk wrote: > Bill Moran schrieb: >  > While I've no objection to someone helping out by converting files, I >> >> find it odd that flv is suggested.  I've yet to find anything that can >> play flv files on my FreeBSD desktop machine.  I'm pretty sure mplaye

Re: [GENERAL] Video available for PGDay SJC '09

2009-07-28 Thread Greg Stark
On Tue, Jul 28, 2009 at 3:38 PM, Christophe Pettus wrote: > > Historically, MOV has been the least-bad container format; Flash support on > anything besides Windows has, traditionally, been very spotty.  The files > themselves are pretty much the same size; FLV is (as noted) a container > format, n

Re: [GENERAL] Video available for PGDay SJC '09

2009-07-28 Thread Greg Stark
On Wed, Jul 29, 2009 at 12:10 AM, John R Pierce wrote: > Greg Stark wrote: >> >> I think I'm scarred from Quicktime files because they often were >> encoded with codecs like Sorensen which produced proprietary formats. >> >> > > agreed, and the quickti

Re: [GENERAL] Clients disconnect but query still runs

2009-07-29 Thread Greg Stark
On Wed, Jul 29, 2009 at 1:58 PM, Jasen Betts wrote: > can't coerce a signal from the network stack? the linux socket(2) > manpage is full of promise (SIGPIPE, SIGURG, SIGIO) [please don't quote the entire message back, just the part you're responding to] Well SIGPIPE is no help since it would onl

Re: [GENERAL] Clients disconnect but query still runs

2009-07-29 Thread Greg Stark
On Wed, Jul 29, 2009 at 3:17 PM, Tom Lane wrote: > Greg Stark writes: >> On Wed, Jul 29, 2009 at 1:58 PM, Jasen Betts wrote: >>> can't coerce a signal from the network stack? the linux socket(2) >>> manpage is full of promise (SIGPIPE, SIGURG, SIGIO) > > &

Re: [GENERAL] Strange Planner Issues

2009-07-29 Thread Greg Stark
On Wed, Jul 29, 2009 at 8:01 PM, Jake Stride wrote: > Hi, > > I have 2 databases running on the same server. One is a dump of the > other, however the query plans for the same query on the same tables > in each database is wildly different and I cannot work out why. >                            

Re: [GENERAL] Clients disconnect but query still runs

2009-07-30 Thread Greg Stark
On Thu, Jul 30, 2009 at 8:41 AM, Tatsuo Ishii wrote: >> Well SIGPIPE is no help since it would only fire if we tried to write >> to the socket anyways. > > Right. For this purpose, pgpool sends param packet to client > periodically while waiting for a reply from backend to detect if the > connectio

Re: [GENERAL] Clients disconnect but query still runs

2009-07-30 Thread Greg Stark
On Thu, Jul 30, 2009 at 7:43 AM, Craig Ringer wrote: > On Wed, 2009-07-29 at 14:56 +0100, Greg Stark wrote: > >> SIGURG might be useful but it would be more complex to use and less >> widely useful since it would only work if the client disconnects >> gracefully (though it

Re: [GENERAL] Clients disconnect but query still runs

2009-07-30 Thread Greg Stark
On Thu, Jul 30, 2009 at 10:27 AM, Csaba Nagy wrote: > > Sorry, I have to disagree here. If there's a spurious network error, you > have usually bigger problems. I prefer to have the connection killed > even if the network recovers I know this is a popular feeling. But you're throwing away decades

Re: [GENERAL] Clients disconnect but query still runs

2009-07-30 Thread Greg Stark
On Thu, Jul 30, 2009 at 10:59 AM, Csaba Nagy wrote: > But if I get bad memory or bad wire I'll get much worse problems > already, and don't tell me it will work more reliably if you don't kill > the connection. It's a lot better to find out sooner that you have those > problems and fix them than ha

Re: [GENERAL] Clients disconnect but query still runs

2009-07-30 Thread Greg Stark
On Thu, Jul 30, 2009 at 12:22 PM, Craig Ringer wrote: > > In fact, I'm not even sure _how_ one goes about exiting without sending an > RST. A quick check shows that when I `kill -9' a process with an open client > socket (ssh, in this case) the OS sends a FIN, and responds to the server's > FIN,ACK

Re: [GENERAL] Clients disconnect but query still runs

2009-07-30 Thread Greg Stark
On Thu, Jul 30, 2009 at 3:20 PM, Tom Lane wrote: > > The earlier part of the discussion was focused on getting the kernel > to actively tell us when the connection had dropped.  That would be > workable if we found a way to request it, but I think we'd run out of > options :-( Yeah, everything I'v

[GENERAL] Re: character 0xe29986 of encoding "UTF8" has no equivalent in "LATIN2"

2009-08-04 Thread Greg Stark
On Tue, Aug 4, 2009 at 4:02 PM, Alban Hertroys wrote: > P.S. Please don't top post and keep some context of what you're replying to. > Your messages are a bit confusing the way you write them. These arguments are more convincing if you don't leave the remainder of the OP's message quoted right be

Re: [GENERAL] smart or dumb partition?

2009-08-07 Thread Greg Stark
On Sat, Aug 8, 2009 at 12:27 AM, Bob Gobeille wrote: > I gather from rtfm that it is typical to set up partitions so that the > "master" table has no records.  But from my understanding of partitions and > doing some tests, I don't see any reason that has to be.  So I'm wondering > if I'm missing s

Re: [GENERAL] 'a' = any( $${'a','x'} )

2009-08-08 Thread Greg Stark
On Sat, Aug 8, 2009 at 12:08 PM, Jasen Betts wrote: > select 'a' = any( $${'a','x'}$$ ) ; postgres=# select 'a' = any( $${"a","x"}$$ ) ; ?column? -- t (1 row) -- greg http://mit.edu/~gsstark/resume.pdf -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make cha

Re: [GENERAL] synchronous_commit and mvcc

2009-08-12 Thread Greg Stark
On Wed, Aug 12, 2009 at 8:28 PM, Kelly Burkhart wrote: > Hello, > > We have synchronous_commit=off in our postgresql.conf file.  Does this > setting affect mvcc? If you don't have a crash then there is absolutely no difference from the clients' point of view (besides speed). If you have a crash y

Re: [GENERAL] comparing NEW and OLD (any good this way?)

2009-08-13 Thread Greg Stark
On Thu, Aug 13, 2009 at 11:44 PM, Daniel Verite wrote: >> In other discussions about similar issues I've said that the expression: >> >>   ROW(NULL,NULL) IS DISTINCT FROM NULL >> >> should evaluate to FALSE.  I still think this is correct and generally >> useful behavior. > > I see no reason to dis

Re: [GENERAL] max_allowed_packet equivalent in Postgres?

2009-08-13 Thread Greg Stark
On Thu, Aug 13, 2009 at 11:20 PM, Sam Mason wrote: > On Thu, Aug 13, 2009 at 03:31:39PM -0400, Greg Smith wrote: >> If your client app is coded correctly to handle large packets of data, it >> should work up to the size limits documented at >> http://www.postgresql.org/about/ , so you probably havi

Re: [GENERAL] max_allowed_packet equivalent in Postgres?

2009-08-13 Thread Greg Stark
On Fri, Aug 14, 2009 at 12:33 AM, Sam Mason wrote: > On Fri, Aug 14, 2009 at 12:03:37AM +0100, Greg Stark wrote: >> On Thu, Aug 13, 2009 at 11:20 PM, Sam Mason wrote: >> > There would be no way of creating a row 1.6TB in size in one go > > I was thinking of a single up

Re: [GENERAL] Getting database data from the PostgreSQL file system

2009-08-14 Thread Greg Stark
On Fri, Aug 14, 2009 at 4:31 PM, Ewgenij Sokolovski wrote: > Hello, Guys! Is that kind of thing possible at all? We have a problem that > our database is corrupted, and we are not able to get any table data by > executing SQL requests/running the PG_Admin tool. So, we thought, maybe it is > poss

Re: [GENERAL] ERROR: attempted to delete invisible tuple

2009-08-17 Thread Greg Stark
On Mon, Aug 17, 2009 at 4:23 PM, Bryan Murphy wrote: >  I've identified 82 bad records.  When I try to query for the records, > we get the following: > ERROR:  missing chunk number 0 for toast value 25692661 in pg_toast_25497233 > That's fine.  I've run into that in a few other tables and have just

Re: [GENERAL] ERROR: attempted to delete invisible tuple

2009-08-17 Thread Greg Stark
On Mon, Aug 17, 2009 at 6:17 PM, Tom Lane wrote: > Bryan Murphy writes: >> Here's the xmin/xmax/ctid for three problematic records: > >> prodpublic=# select xmin,xmax,ctid from items_extended where id in >> ('34537ed90d7546d78f2c172fc8eed687', '3e1d99b7124742b7aaf2f869f7637b0e', >> '499b464f141a48

Re: [GENERAL] ERROR: attempted to delete invisible tuple

2009-08-17 Thread Greg Stark
On Mon, Aug 17, 2009 at 6:17 PM, Tom Lane wrote: > Hm, what's your current XID counter?  (pg_controldata would give an > approximate answer.)  I'm wondering if the xmax's are marked committed > but are in the future ... > FWIW that doesn't look right. That would result in HeapTupleBeingUpdated. Th

Re: [GENERAL] ERROR: attempted to delete invisible tuple

2009-08-17 Thread Greg Stark
On Mon, Aug 17, 2009 at 7:59 PM, Tom Lane wrote: > Greg Stark writes: >> Excluding the cases where our own xid is in the tuple I think the >> relevant cases are either > >> xmin aborted or in progress (or in future) >> MOVED_OFF and xvac committed >> MOVED_I

Re: [GENERAL] Rapid Seek Devices (feature request)

2009-08-17 Thread Greg Stark
2009/8/17 Jeremy Harris : > Could not pgsql *measure* these costs (on a sampling basis, and with long > time-constants)? In theory, sure. In practice, well, there are some engineering challenges to solve. 1) The cost model isn't perfect so the it's not clear exactly what to measure to get the bes

Re: [GENERAL] Failover, Wal Logging, and Multiple Spares

2009-08-17 Thread Greg Stark
On Tue, Aug 18, 2009 at 1:25 AM, Yaroslav Tykhiy wrote: > Encouraged by Bruce Momjian, I tried and had some success in this area.  It > was a controlled failover but it worked like a charm.  An obvious condition > was that the warm standbys be in perfect sync; you can't do the trick if > some of th

Re: [GENERAL] PQgetlength vs. octet_length()

2009-08-18 Thread Greg Stark
On Tue, Aug 18, 2009 at 6:39 PM, Michael Clark wrote: > But it seems pretty crazy that a 140meg bit of data goes to 1.3 gigs.  Does > that seem a bit excessive? From what you posted earlier it looked like it was turning into about 500M which sounds about right. Presumably either libpq or your code

[GENERAL] Re: Unit conversion database (was: multiple paramters in aggregate function)

2009-08-19 Thread Greg Stark
On Wed, Aug 19, 2009 at 8:24 PM, Alvaro Herrera wrote: >> [1] It doesn't correctly convert °C to °F or vv, that was one of the >> first things I tried. > > Seems it's easy to misuse it.  You need tempF(x) and tempC notation for > converting absolute temperature differences: > > You have: tempF(212)

Re: [GENERAL] Stock Market Price Data & postgreSQL? HELLPPP Please

2009-08-19 Thread Greg Stark
On Wed, Aug 19, 2009 at 9:22 PM, Sanjay Arora wrote: > - This is Time Series Data (I don't know what that is except that it > relates to data marked/related to time) and not suited to a RDBMS. > - You need it in Esper (a CEP engine used by Marketcetera, an open > source trading platform) which need

Re: [GENERAL] unique index for periods

2009-08-20 Thread Greg Stark
On Thu, Aug 20, 2009 at 3:14 PM, Tom Lane wrote: > I don't believe it is possible to use a btree index for this purpose, > because there just isn't a way to express "overlaps" as a total order. That's true for the general case of indexing ranges but I don't think that's true for the case where ove

Re: [GENERAL] join from array or cursor

2009-08-21 Thread Greg Stark
On Fri, Aug 21, 2009 at 1:16 PM, John DeSoi wrote: > > Yes, this is the best I have come up with so far. I have a set returning > function which returns the key and the index number. The implementation with > a cursor looks like this: > > SELECT * FROM cursor_pk('c1') c LEFT JOIN foo ON (c.pk = foo

Re: [GENERAL] join from array or cursor

2009-08-21 Thread Greg Stark
On Fri, Aug 21, 2009 at 2:16 PM, Greg Stark wrote: > On Fri, Aug 21, 2009 at 1:16 PM, John DeSoi wrote: >> >> Yes, this is the best I have come up with so far. I have a set returning >> function which returns the key and the index number. The implementation with >&g

Re: [GENERAL] Error inserting data to bytea column in 8.4

2009-08-21 Thread Greg Stark
2009/8/21 Andrus Moor : > In 8.4, script > > create temp table test ( test bytea ); > insert into test values(E'\274') Try E'\\274' -- greg http://mit.edu/~gsstark/resume.pdf -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www

Re: [GENERAL] Multiple table entries?

2009-08-22 Thread Greg Stark
On Sat, Aug 22, 2009 at 9:31 PM, Jeff Ross wrote: > Hi, > > I recently upgraded to 8.4 and everything went great.  All databases are > working as they are supposed to, no problems seen. > > Today, however, I did a \d on a database and was surprised to see sets of 5 > identical table entries for eac

Re: [GENERAL] Multiple table entries?

2009-08-22 Thread Greg Stark
On Sat, Aug 22, 2009 at 9:31 PM, Jeff Ross wrote: > I browsed through the system catalogs but haven't found anything yet that > can shine some light on this. Actually, I wonder if this isn't more likely to show the problem -- it would explain why *all* your tables are showing up with duplicates ra

Re: [GENERAL] join from array or cursor

2009-08-22 Thread Greg Stark
On Sun, Aug 23, 2009 at 1:30 AM, John DeSoi wrote: > While it avoids the sort of my method, it appears to be almost 5 times > slower (about 4000 keys in the cursor, Postgres 8.4.0): > > > Function Scan on cursor_pk arr  (cost=0.00..116011.72 rows=1000 width=4) > (actual time=13.561..249.916 rows=43

Re: [GENERAL] Multiple table entries?

2009-08-22 Thread Greg Stark
On Sun, Aug 23, 2009 at 4:06 AM, Jeff Ross wrote: > Greg Stark wrote: >> Actually, I wonder if this isn't more likely to show the problem -- it >> would explain why *all* your tables are showing up with duplicates >> rather than just one. >> >> select

Re: [GENERAL] Multiple table entries?

2009-08-22 Thread Greg Stark
On Sun, Aug 23, 2009 at 4:40 AM, Greg Stark wrote: > On Sun, Aug 23, 2009 at 4:06 AM, Jeff Ross wrote: >> Greg Stark wrote: > > Yeah, that's a problem. Would you be able to load the pageinspect > contrib module and run a query? > > select (h).* from (select &

Re: [GENERAL] Multiple table entries?

2009-08-23 Thread Greg Stark
On Sun, Aug 23, 2009 at 2:18 PM, Jeff Ross wrote: > I had to modify your query slightly to make it run--hope I got what you are > after! > > select (h).* from (select > heap_page_items(get_raw_page('pg_namespace',0)) as h) as x; > > http://www.openvistas.net/pageinspect.html Incidentally, may as w

Re: [GENERAL] Multiple table entries?

2009-08-23 Thread Greg Stark
On Sun, Aug 23, 2009 at 5:37 PM, Jeff Ross wrote: > > pg_clog is 32K.  I've put it at http://www.openvistas.net/pg_clog Sorry, I'm getting a 404 -- greg http://mit.edu/~gsstark/resume.pdf -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscriptio

Re: [GENERAL] Multiple table entries?

2009-08-23 Thread Greg Stark
On Sun, Aug 23, 2009 at 6:23 PM, Greg Stark wrote: > On Sun, Aug 23, 2009 at 5:37 PM, Jeff Ross wrote: >> >> pg_clog is 32K.  I've put it at http://www.openvistas.net/pg_clog > > Sorry, I'm getting a 404 For what it's worth this is what the heap dump shows.

Re: [GENERAL] Multiple table entries?

2009-08-23 Thread Greg Stark
On Sun, Aug 23, 2009 at 7:00 PM, Tom Lane wrote: > Greg Stark writes: >> The last tuple is marked strangely I think. I don't think it's >> supposed to have XMAX_INVALID if xmax is 0 but I could be wrong. Also, >> I don't understand why it's marked as UPDAT

Re: [GENERAL] Multiple table entries?

2009-08-23 Thread Greg Stark
On Sun, Aug 23, 2009 at 7:34 PM, Tom Lane wrote: > Greg Stark writes: >> On Sun, Aug 23, 2009 at 7:00 PM, Tom Lane wrote: >>> But we don't use that while examining individual tuples, do we? > >> We don't use the visibility map itself but we *do* use the p

Re: [GENERAL] Multiple table entries?

2009-08-23 Thread Greg Stark
On Sun, Aug 23, 2009 at 5:02 PM, Greg Stark wrote: > On Sun, Aug 23, 2009 at 2:18 PM, Jeff Ross wrote: > Incidentally, may as well ask the usual questions: And just for reference, what does pg_controldata print? -- greg http://mit.edu/~gsstark/resume.pdf -- Sent via pgsql-general mailin

Re: [GENERAL] Multiple table entries?

2009-08-23 Thread Greg Stark
On Sun, Aug 23, 2009 at 9:06 PM, Jeff Ross wrote: > pglogd=# select (h).* from (select >  page_header(get_raw_page('pg_namespace',0)) > pglogd(# as h) as x; >   lsn    | tli | flags | lower | upper | special | pagesize | version | > prune_xid > ---+-+---+---+---+-+--

Re: [GENERAL] Multiple table entries?

2009-08-24 Thread Greg Stark
On Mon, Aug 24, 2009 at 2:03 AM, Tom Lane wrote: > Jeff Ross writes: >> Tom Lane wrote: >>> heap_update is broken.  Details left as an exercise for the reader > >> Well, as the reader that started this all ;-) should I be worried? >> Should I do a pg_dump and reinstall?  Roll back to 8.3.7?  Or ju

Re: [GENERAL] Tagged types module and varlena changes

2009-08-26 Thread Greg Stark
On Wed, Aug 26, 2009 at 1:14 PM, Alban Hertroys wrote: >> struct varlena* tv = (struct varlena*)tt_palloc( VARSIZE( datum ) ); >> >> tv->vl_len = VARSIZE( datum ) - sizeof(Oid); >> memcpy( tv->vl_dat, >>        &((struct taggedtypev*)DatumGetPointer( datum ))->val, >>        VARSIZE(datum) - sizeof

Re: [GENERAL] How to simulate crashes of PostgreSQL?

2009-08-27 Thread Greg Stark
On Fri, Aug 28, 2009 at 4:13 AM, Alvaro Herrera wrote: > Maybe we should have another inter-backend signal: when a process gets > ENFILE, signal all other backends and they close a bunch of files each. I wonder if this is a new problem due to the FSM and VM using up extra file handles? -- greg

Re: [GENERAL] How useful is the money datatype?

2009-10-03 Thread Greg Stark
2009/10/3 Grzegorz Jaśkiewicz : > depending on the countries, etc - keep currencies in 10.4 , or you can > compromise to 10.3 , otherwise you might run into problems with rounding, > etc. Keeping more digits of precision than the application actually can use is more likely to *cause* problems with

[GENERAL] Re: PostgreSQL reads each 8k block - no larger blocks are used - even on sequential scans

2009-10-03 Thread Greg Stark
On Sun, Sep 27, 2009 at 11:18 AM, Sam Mason wrote: > On Sun, Sep 27, 2009 at 06:05:51PM +0200, Gerhard Wiesinger wrote: >> A google research has shown that Gregory Stark already worked on that issue >> (see references below) but as far as I saw only on bitmap heap scans. > > Greg Stark's patches a

Re: [GENERAL] Errors regarding transporting database using pg_dump

2009-10-05 Thread Greg Stark
On Mon, Oct 5, 2009 at 7:34 AM, Martijn van Oosterhout wrote: > That said, why are you doint this anyway. A better solution may be to > install a trusted language (like plperlu or plpython) and do the system > call from there. > If you just want system(3) you might as well use plsh... -- greg

Re: [GENERAL] contrib/plantuner - enable PostgreSQL planner hints

2009-10-16 Thread Greg Stark
On Fri, Oct 16, 2009 at 10:04 AM, decibel wrote: > Out of curiosity, did you look at doing hints as comments in a query? I'm > guessing you couldn't actually do that in just a contrib module, but it's > how Oracle handles hints, and it seems to be *much* more convenient, because > a hint only appl

Re: [GENERAL] Help with postgresql memory issue

2009-10-28 Thread Greg Stark
On Wed, Oct 28, 2009 at 1:05 PM, Brooks Lyrette wrote: > The machine is running a moderate load. This is running on a Solaris Zone. > > Memory: 32G phys mem, 942M free mem, 76G swap, 74G free swap > >   PID USERNAME LWP PRI NICE  SIZE   RES STATE    TIME    CPU COMMAND >  5069 postgres   1  52    

Re: [GENERAL] Sorting with materialized paths

2010-05-10 Thread Greg Stark
On Sun, May 9, 2010 at 4:47 PM, Tom Lane wrote: > Ovid writes: >> My apologies. This isn't PG-specific, but since this is running on >> PostgreSQL 8.4, maybe there are specific features which might help. >> I have a tree structure in a table and it uses materialized paths to allow >> me to find

Re: [GENERAL] R-Trees in PostgreSQL

2009-11-02 Thread Greg Stark
On Mon, Nov 2, 2009 at 4:41 PM, Jeff Davis wrote: > On Tue, 2009-11-03 at 00:25 +0100, Viktor Rosenfeld wrote: >> I'd like to know what kind of functions I have to implement for a R-Tree >> index on numeric columns, > > NUMERIC is scalar, so an R-Tree doesn't make much sense. You can install > btr

Re: [GENERAL] sudoku in an sql statement

2009-11-04 Thread Greg Stark
On Sun, Nov 1, 2009 at 3:19 PM, Tom Lane wrote: > I think the Oracle guy's version could easily be adapted to PG 8.4 --- > those little rownum subqueries seem to be just a substitute for not > having generate_series(1,9), and everything else is just string-pushing. > Don't have time to try it myse

Re: [GENERAL] virtualidx exclusive lock

2009-11-09 Thread Greg Stark
On Mon, Nov 9, 2009 at 7:38 AM, Uwe Schroeder wrote: > What I noticed is when I look at pg_locks, pretty much all of the processes > being idle in transaction have an exclusive lock of locktype "virtualidx". It's "virtualxid" as in "virtual transaction id" and hopefully more than pretty much all

  1   2   3   4   5   6   >