Re: [GENERAL] REASSIGN OWNED simply doesn't work

2017-10-16 Thread Sam Gendler
dy for non-superuser roles - cleaning up their mistake. --sam On Fri, Oct 13, 2017 at 12:39 PM, David G. Johnston < david.g.johns...@gmail.com> wrote: > On Fri, Oct 13, 2017 at 6:04 AM, Alvaro Herrera <alvhe...@alvh.no-ip.org> > wrote: > >> Sam Gendler wrote:

[GENERAL] REASSIGN OWNED simply doesn't work

2017-10-12 Thread Sam Gendler
psql 9.6.3 on OS X. I'm dealing with a production database in which all db access has been made by the same user - the db owner, which isn't actually a superuser because the db runs on amazon RDS - amazon retains the superuser privilege for its own users and makes non-superuser role with

Re: [GENERAL] Why is posgres picking a suboptimal plan for this query?

2017-05-25 Thread Sam Saffron
OK, I committed a fix to Discourse, the suggested pattern by Tom works like a charm, in my particular user case it cuts a query down from 200-500ms to 8ms. Thank you heaps https://github.com/discourse/discourse/commit/29fac1ac18acdc1f0d2c1650d33d2d4a1aab0a0b On Wed, May 24, 2017 at 6:33 PM, Sam

Re: [GENERAL] Why is posgres picking a suboptimal plan for this query?

2017-05-24 Thread Sam Saffron
Awesome, thanks! I will give that a shot On Wed, 24 May 2017 at 6:14 pm, Tom Lane <t...@sss.pgh.pa.us> wrote: > Jeff Janes <jeff.ja...@gmail.com> writes: > > On Wed, May 24, 2017 at 1:42 PM, Sam Saffron <sam.saff...@gmail.com> > wrote: > >> I have this qu

[GENERAL] Why is posgres picking a suboptimal plan for this query?

2017-05-24 Thread Sam Saffron
I have this query that is not picking the right index unless I hard code dates: SELECT "topics".* FROM "topics" WHERE topics.last_unread_at >= '2017-05-11 20:56:24' "Index Scan using index_topics_on_last_unread_at on topics (cost=0.41..8.43 rows=1 width=725) (actual time=0.005..0.065 rows=5

Re: [GENERAL] How do I bump a row to the front of sort efficiently

2015-02-04 Thread Sam Saffron
to be able to offset and limit the union hack in a view, which is proving very tricky. On Wed, Feb 4, 2015 at 9:15 PM, BladeOfLight16 bladeofligh...@gmail.com wrote: On Tue, Feb 3, 2015 at 11:28 PM, Sam Saffron sam.saff...@gmail.com wrote: Note: I still consider this a bug/missing feature of sorts

Re: [GENERAL] How do I bump a row to the front of sort efficiently

2015-02-03 Thread Sam Saffron
Note: I still consider this a bug/missing feature of sorts since the planner could do better here, and there is no real clean way of structuring a query to perform efficiently here, which is why I erroneously cross posted this to hacker initially: # create table testing(id serial primary key,

[GENERAL] How do I bump a row to the front of sort efficiently

2015-02-01 Thread Sam Saffron
I have this query: select * from topics order by case when id=1 then 0 else 1 end, bumped_at desc limit 30 It works fine, bumps id 1 to the front of the sort fine but is terribly inefficient and scans OTH select * from topics where id = 1 is super fast select * from topics order by bumped_at

Re: [HACKERS] [GENERAL] Performance issue with libpq prepared queries on 9.3 and 9.4

2014-11-17 Thread Sam Saffron
One interesting option would be kicking in an extra more expensive planning cycle after the Nth run of the query, in general a lot of these planned queries run 1000s of times, if you add some extra cost to run 100 it may not be prohibitive cost wise. On Tue, Nov 18, 2014 at 8:27 AM, Tom Lane

[GENERAL] Performance issue with libpq prepared queries on 9.3 and 9.4

2014-11-13 Thread Sam Saffron
(stderr, raw %f \n, (finish-start)); /* close the connection to the database and cleanup */ PQfinish(conn); return 0; } ``` Results: ```text sam@ubuntu pq_play % cc -o play -I/usr/include/postgresql play.c -lpq -L/usr/include/postgresql/libpq ./play connecting database prepared

Re: [GENERAL] Performance issue with libpq prepared queries on 9.3 and 9.4

2014-11-13 Thread Sam Saffron
the value in some steps. (so, for example I was thinking that aaa and ccc would result in completely different plans) Thank you so much for your time, patience and general awesomeness On Fri, Nov 14, 2014 at 11:34 AM, Tom Lane t...@sss.pgh.pa.us wrote: Sam Saffron sam.saff...@gmail.com writes: I

[GENERAL] PgAdmin errors

2014-03-26 Thread Hall, Samuel L (Sam)
When I try to run SQL from PgAdmin : CREATE TABLE tse_history_old LIKE tse_history INCLUDING ALL WITH OIDS I get this error ERROR: syntax error at or near LIKE LINE 2: CREATE TABLE tse_history_old LIKE tse_history INCLUDING ALL ... testing, I find that using the word LIKE always causes errors

Re: [GENERAL] PgAdmin errors

2014-03-26 Thread Hall, Samuel L (Sam)
: [GENERAL] PgAdmin errors On 3/26/2014 12:32 PM, Hall, Samuel L (Sam) wrote: When I try to run SQL from PgAdmin : CREATE TABLE tse_history_old LIKE tse_history INCLUDING ALL WITH OIDS I get this error ERROR: syntax error at or near LIKE LINE 2: CREATE TABLE tse_history_old LIKE tse_history INCLUDING

Re: [GENERAL] PgAdmin errors

2014-03-26 Thread Hall, Samuel L (Sam)
: Wednesday, March 26, 2014 3:02 PM To: pgsql-general@postgresql.org Subject: Re: [GENERAL] PgAdmin errors On 3/26/2014 12:58 PM, Hall, Samuel L (Sam) wrote: That doesn't help. Even this CREATE TABLE tse_history_old (LIKE tse_history) gives an error the exact same error ? -- john r pierce

Re: [GENERAL] PgAdmin errors

2014-03-26 Thread Hall, Samuel L (Sam)
Yes PostgreSQL 9.3.0 on x86_64-unknown-linux-gnu, compiled by gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3, 64-bit -Original Message- From: Tom Lane [mailto:t...@sss.pgh.pa.us] Sent: Wednesday, March 26, 2014 4:03 PM To: Hall, Samuel L (Sam) Cc: John R Pierce; pgsql-general@postgresql.org

[GENERAL] Failure upgrading PG 9.2 to 9.3

2014-03-25 Thread Sam Saffron
I am getting the following failure on a customer DB upgrading 9.2 to 9.3 Selecting previously unselected package postgresql-9.2. Unpacking postgresql-9.2 (from .../postgresql-9.2_9.2.8-1.pgdg12.4+1_amd64.deb) ... Processing triggers for postgresql-common ... Setting up postgresql-client-9.2

Re: [GENERAL] Failure upgrading PG 9.2 to 9.3

2014-03-25 Thread Sam Saffron
Thanks heaps Tom, I can confirm corrupt db upgrades fine with pg_dump. Was wondering if there are any plans to add a --no-validate to pg_upgrade, since the crash seems only to happen during validation. Cheers Sam On Wed, Mar 26, 2014 at 3:19 AM, Tom Lane t...@sss.pgh.pa.us wrote: Sam Saffron

Re: [GENERAL] Failure upgrading PG 9.2 to 9.3

2014-03-25 Thread Sam Saffron
...@aklaver.com wrote: On 03/25/2014 04:32 PM, Sam Saffron wrote: Thanks heaps Tom, I can confirm corrupt db upgrades fine with pg_dump. Was wondering if there are any plans to add a --no-validate to pg_upgrade, since the crash seems only to happen during validation. Hmm, so I am still unclear

Re: [GENERAL] Failure upgrading PG 9.2 to 9.3

2014-03-25 Thread Sam Saffron
9.2 is the problem instance, 9.3 is clean, I am able to do many upgrades without issues with the same script (which spawns a clean 9.3 instance and then pg_upgrades to it.) On Wed, Mar 26, 2014 at 11:13 AM, Adrian Klaver adrian.kla...@aklaver.com wrote: On 03/25/2014 05:03 PM, Sam Saffron wrote

[GENERAL] backup and restore functions

2013-09-24 Thread Hall, Samuel L (Sam)
I have a Postgressql-9.2 database with postgis-2.0 in production service. Due, I think, to a bad postgis upgrade, there are both old and new functions present. I am planning to install Postgresql-9.3 and Postgis-2.01 and then copy the data over with pg_upgrade. My question is: Will this also

Re: [GENERAL] Call for design: PostgreSQL mugs

2013-09-09 Thread Sam Hahn
How about * Postgres -the Linux of Data (or) * The Linux of DBs ?? On 9/8/2013 4:51 PM, Bret Stern wrote: PostgreSQL - (the worlds database)

[GENERAL] Update quey

2013-08-23 Thread Hall, Samuel L (Sam)
I have a table (pubacc_lo) from the US government with 500,00+ rows. It has latitude and longitude in three columns each for degrees, minutes and seconds. I need a Point geometry column. So I wrote this query: with mydata AS (SELECT (pubacc_lo.lat_degrees + pubacc_lo.lat_minutes/60 +

Re: [GENERAL] Update quey

2013-08-23 Thread Hall, Samuel L (Sam)
Thank you! That worked fine. From: bricklen [mailto:brick...@gmail.com] Sent: Friday, August 23, 2013 10:08 AM To: Hall, Samuel L (Sam) Cc: pgsql-general@postgresql.org Subject: Re: [GENERAL] Update quey On Fri, Aug 23, 2013 at 8:04 AM, Hall, Samuel L (Sam) sam.h...@alcatel

[GENERAL] Problem with at_askml function in Postgis

2013-06-26 Thread Hall, Samuel L (Sam)
Using PostgreSQL 9.1.8 on x86_64-unknown-linux-gnu, compiled by gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3, 64-bit POSTGIS=2.0.1 r9979 GEOS=3.3.3-CAPI-1.7.4 PROJ=Rel. 4.8.0, 6 March 2012 GDAL=GDAL 1.9.2, released 2012/10/08 LIBXML=2.8.0 LIBJSON=UNKNOWN TOPOLOGY RASTER Postgis seems to be

[GENERAL] Finding the synchronous slave after a master crash

2013-06-18 Thread Sam Crawley
master could be correctly selected (or that the synchronous slave is also uncontactable, meaning we can't promote a new master without risking data loss). Is there some mechanism for finding this that I've missed, or some other way around this problem? Thanks, Sam Crawley. -- Sent via pgsql

[GENERAL] Double types

2012-09-18 Thread Hall, Samuel L (Sam)
I have an application that writes an Excel Spreadsheet to postgres. For the values that go in number fields, I check the Excel values for dbnull and set the parameters to 0, like this: cmd.Parameters(9).Value = 0. Npgsql throws an error format specifier was invalid If I do this:

[GENERAL] Estimated rows question

2012-08-21 Thread Sam Ross
in mergejoinscansel, and indeed if you inspect leftstartsel, leftendsel, rightstartsel, rightendsel during execution they are respectively 0.98, 1.00, 0.00, 0.020, which I believe makes sense. Am I missing something obvious? Thanks Sam create table table_a as select * from generate_series(1,61000

[GENERAL] efficiency of wildcards at both ends

2012-06-20 Thread Sam Z J
me to the relavant text =D thanks -- Zhongshi (Sam) Jiang sammyjiang...@gmail.com

Re: [GENERAL] efficiency of wildcards at both ends

2012-06-20 Thread Sam Z J
thank you all for the useful information =D On Wed, Jun 20, 2012 at 1:39 PM, Alan Hodgson ahodg...@simkin.ca wrote: On Wednesday, June 20, 2012 01:10:03 PM Sam Z J wrote: Hi all I'm curious how is wildcards at both ends implemented, e.g. LIKE '%str%' How efficient is it if that's

Re: [GENERAL] Is it even possible?

2012-03-21 Thread Sam Loy
database following the instructions in the README. Worked without a hitch! Then I loaded up the data I care about…and now I am UP AND RUNNING! Thanks, Bryan, et.al. Great help. I hope to be able to help others as you have helped me! With sincere gratitude, Sam P.S. So long Winwoes! So long confused

[GENERAL] Is it even possible?

2012-03-20 Thread Sam Loy
I have now tried at least 7 different install methods to get pg up and running on Lion. I fear that my system is now thoroughly inoculated and will never be able to run postgres/postgis. I started with the pg mac installer / stack builder. That worked to get pg installed, but could not get

Re: [GENERAL] Is it even possible?

2012-03-20 Thread Sam Loy
Looks promising. Does anyone know if you install tpostgres using the postgres EDB before using Kyng Chaos'. Im not sure of the process… Thanks, Sam On Mar 20, 2012, at 3:16 PM, Bryan Lee Nuse wrote: Is there anyone who has ever successfully gotten postgres/postGIS running on Mac Lion

[GENERAL] SELECT FOR UPDATE could see commited trasaction partially.

2012-03-04 Thread Sam Wong
- does resolve my issue but it creates a big lock contention problem, and relies on app to do the right thing. * Advisory lock - pretty much the same, except that I could unlock earlier to make the locking period shorter, but nevertheless it's the whole table lock. Thoughts? Thanks, Sam

[GENERAL] JDBC Connection Errors

2011-08-23 Thread Sam Nelson
Hi list, A client is hitting an issue with JDBC: org.postgresql.util.PSQLException: Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections. -pg_hba.conf is set to trust 0.0.0.0/0 (IPv4 only) -listen_addresses is * -I can find no

Re: [GENERAL] JDBC Connection Errors

2011-08-23 Thread Sam Nelson
-955-0509 === On Tue, Aug 23, 2011 at 5:46 PM, Adrian Klaver adrian.kla...@gmail.com wrote: On Tuesday, August 23, 2011 3:47:33 pm Sam Nelson wrote: Hi list, A client is hitting an issue with JDBC: org.postgresql.util.PSQLException: Connection refused. Check

Re: [GENERAL] streaming replication: one problem several questions

2011-08-11 Thread Pedro Sam
Do your machines have the same architecture? (64 bit vs 32 bit) - This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or

[GENERAL] Hot Standby Lag Calculation

2011-08-03 Thread Sam Nelson
Hi, List, We're trying to calculate the amount of time that a Hot Standby slave is lagging behind its master, and our results look wrong (average of 7 seconds, with some over 1 minute), so we were thinking that we're probably calculating it wrong. We're currently just using the timestamps from

Re: [GENERAL] Timeline Conflict

2011-08-02 Thread Pedro Sam
I've been trying to use repmgr for just that purpose. Looks like it simply creates/modifies a recovery.conf pointing primary_conninfo to the new master, and then restart. It does not seem to have the ability to resolve any timeline conflicts at all. Am I using repmgr incorrectly?

[GENERAL] dblink() from GridSQL

2011-05-05 Thread Sam Nelson
Hi List, We have a customer who is trying to migrate a few PostgresPlus instances to GridSQL clusters. They have a process that pulls data from another server using dblink every night, and we're trying to replicate that on the GridSQL instance, but grid is being a bit of a pain. Grid doesn't

Re: [GENERAL] dblink() from GridSQL

2011-05-05 Thread Sam Nelson
Moncure mmonc...@gmail.com wrote: On Thu, May 5, 2011 at 12:13 PM, Sam Nelson s...@consistentstate.com wrote: Hi List, We have a customer who is trying to migrate a few PostgresPlus instances to GridSQL clusters. They have a process that pulls data from another server using dblink every

Re: [GENERAL] very basic SQL question

2010-11-23 Thread Sam Mason
for is UPSERT, the following looks relevant: http://stackoverflow.com/questions/1109061/insert-on-duplicate-update-postgresql -- Sam http://samason.me.uk/ -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref

Re: [GENERAL] Query to get the next available unique suffix for a name

2010-09-28 Thread Sam Mason
it. Why not do something like: SELECT max(nullif(substring(username FROM '[0-9]*$'),'')::numeric) AS lastnum FROM users WHERE username ~ '^MikeChristensen[0-9]*$'; It's a pretty direct translation from what I'd do in any imperative language. -- Sam http://samason.me.uk/ -- Sent via

Re: [GENERAL] huge difference in performance between MS SQL and pg 8.3 on UPDATE with full text search

2010-09-28 Thread Sam Mason
for whatever is needed, or better serve as a useful cache. Rebooting normally just hides other issues. -- Sam http://samason.me.uk/ -- 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] Memory Errors

2010-09-21 Thread Sam Nelson
ability to remember things is ... questionable. -Sam On Thu, Sep 9, 2010 at 8:14 AM, Merlin Moncure mmonc...@gmail.com wrote: On Wed, Sep 8, 2010 at 6:55 PM, Sam Nelson s...@consistentstate.com wrote: Even if the corruption wasn't a result of that, we weren't too excited about the process

Re: [GENERAL] where does postgres keep the query result until it is returned?

2010-09-17 Thread Sam Mason
. There are various ways of dealing with this, but haven't tried myself. -- Sam http://samason.me.uk/ -- 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] where does postgres keep the query result until it is returned?

2010-09-17 Thread Sam Mason
On Fri, Sep 17, 2010 at 02:14:57PM +0100, Sam Mason wrote: Postgres, the server software, will spill large results (and any intermediate working sets) to disk automatically as needed. I believe any memory allocated for this task will be up to work_mem in size. That wasn't very clear

Re: [GENERAL] SELF LEFT OUTER JOIN = SELF JOIN including NULL values

2010-09-17 Thread Sam Mason
),(NULL)) SELECT l.v, r.v, l.v = r.v AS equality, l.v IS NOT DISTINCT FROM r.v AS isnotdistinctfrom FROM x l, x r; -- Sam http://samason.me.uk/ -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref

Re: [GENERAL] where does postgres keep the query result until it is returned?

2010-09-17 Thread Sam Mason
with that row. When you're running a 32bit version of PG, values whose size is beyond ~100MB are a bit touch and go whether it will work. -- Sam http://samason.me.uk/ -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org

Re: [GENERAL] Need magic for identifieing double adresses

2010-09-16 Thread Sam Mason
then check through and correct the entries where they really should be the same. What to do depends on how much data you have; a few thousand and you can do lots of fiddling by hand, whereas if you have a few tens of millions of people you want to try and do more with code. -- Sam http

Re: [GENERAL] Need magic for identifieing double adresses

2010-09-16 Thread Sam Mason
Strawberry Str. 42-45 Soundex gets those all the same (and even '42-45 Strawberry Str'), so that's easy. In fact it completely ignores the numbers so you'll have to do something specific about them. -- Sam http://samason.me.uk/ -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org

Re: [GENERAL] Transposing rows and columns

2010-09-16 Thread Sam Mason
you're trying to deal with. If I've got my assumption about primary key wrong then my code, as well as the tablefunc, will probably both fail to do the right thing. -- Sam http://samason.me.uk/ -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your

Re: [GENERAL] Transposing rows and columns

2010-09-16 Thread Sam Mason
On Thu, Sep 16, 2010 at 01:44:30PM -0400, Aram Fingal wrote: On Sep 16, 2010, at 12:28 PM, Sam Mason wrote: If you want to do the transformation in SQL, you'd be writing something like: SELECT drug, dose MIN(CASE subject WHEN 1 THEN response END) AS resp_1, MIN(CASE subject

Re: [GENERAL] Post Install / Secure PostgreSQL

2010-09-13 Thread Sam Mason
-- Sam http://samason.me.uk/ -- 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] joins with text search

2010-09-08 Thread Sam Mason
it as a tsvector literal, probably quoting it first, maybe something like: coalesce(setweight(quote_literal(p.part_number)::tsvector,'B'),'') -- Sam http://samason.me.uk/ -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http

[GENERAL] Memory Errors

2010-09-08 Thread Sam Nelson
Hey, a client of ours has been having some data corruption in their database. We got the data corruption fixed and we believe we've discovered the cause (they had a script killing any waiting queries if the locks on their database hit 1000), but they're still getting errors from one table:

Re: [GENERAL] Memory Errors

2010-09-08 Thread Sam Nelson
worked. On Wed, Sep 8, 2010 at 1:30 PM, Tom Lane t...@sss.pgh.pa.us wrote: Sam Nelson s...@consistentstate.com writes: pg_dump: Error message from server: ERROR: invalid memory alloc request size 18446744073709551613 pg_dump: The command was: COPY public.foo (columns) TO stdout

Re: [GENERAL] Memory Errors

2010-09-08 Thread Sam Nelson
is insufficient, so there's a good chance that I'll forget to post back to the mailing list with the results, but I'll try to remember to do so. Thank you for the help - I'm sure I'll be back soon with many more questions. -Sam On Wed, Sep 8, 2010 at 2:58 PM, Tom Lane t...@sss.pgh.pa.us wrote: Merlin Moncure

Re: [GENERAL] Connection question

2010-09-01 Thread Sam Mason
1.6.14. I'd guess you're connecting to PG using the network and not staying within Windows. What does your connection string look like? Getting it using localhost would be my suggestion. -- Sam http://samason.me.uk/ -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org

Re: [GENERAL] WAL Archive Log

2010-08-27 Thread Sam Nelson
is copied to the archive directory (using the archive_command), right? Is there any way we could somehow get postgres to log a line for us, so that we get that line in the postgres log file? Or are we going to have to use a separate file? Thanks much. -Sam On Thu, Aug 26, 2010 at 5:33 PM, Alvaro

Re: [GENERAL] Feature proposal

2010-08-26 Thread Sam Mason
+ or pg_total_relation_size) about 1MB per second what I'd expect it should grow at checkpoints only, not all the time - am I wrong? AFAIU, it'll constantly grow. -- Sam http://samason.me.uk/ -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your

[GENERAL] WAL Archive Log

2010-08-26 Thread Sam Nelson
staring at our screens and blinking. Seriously. It took me a good five minutes to muster the brain power to write this email. -Sam

Re: [GENERAL] Warm Standby Weirdness

2010-08-20 Thread Sam Nelson
Wow. I must be blind. Or brain dead. You're right. That was the issue. -Sam On Thu, Aug 19, 2010 at 9:22 PM, Tom Lane t...@sss.pgh.pa.us wrote: Sam Nelson s...@consistentstate.com writes: Here's the output from pg_controldata: $ pg_controldata `pwd` WARNING: Calculated CRC checksum

Re: [GENERAL] Massively Parallel transactioning?

2010-08-19 Thread Sam Mason
it's needed for correctness; how do you handle the case of only some databases receiving the COMMIT command otherwise? -- Sam http://samason.me.uk/ -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql

[GENERAL] Missing Toast Chunk

2010-08-19 Thread Sam Nelson
? Any ideas? -Sam

Re: [GENERAL] Missing Toast Chunk

2010-08-19 Thread Sam Nelson
Sorry, I forgot to mention that we also tried reindexing the toast table. On Thu, Aug 19, 2010 at 1:20 PM, Scott Marlowe scott.marl...@gmail.comwrote: SNIP It's almost certainly not ruby's fault. Have they done anything strange like kill the instance and restart it without letting the db

[GENERAL] Warm Standby Weirdness

2010-08-19 Thread Sam Nelson
Let me preface this by saying that I've set up warm standby instances quite a few times. I think I sort of hopefully know what I'm doing. pg_start_backup('stuff'), tar data directory, pg_stop_backup(), copy data directory to warm standby server, extract in data directory, etc. We have two

Re: [GENERAL] Missing Toast Chunk

2010-08-19 Thread Sam Nelson
with the database in the last while. Thanks for your help. -Sam On Thu, Aug 19, 2010 at 5:14 PM, Tom Lane t...@sss.pgh.pa.us wrote: Sam Nelson s...@consistentstate.com writes: It's almost certainly not ruby's fault. Have they done anything strange like kill the instance and restart

Re: [GENERAL] Histogram generator

2010-07-28 Thread Sam Mason
(date_part('epoch',foo) / (30*60)); This will save PG from converting back to a date for every row when it's going to chuck most of them away anyway. Hope that gives you some more ideas! -- Sam http://samason.me.uk/ -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org

Re: [GENERAL] Server load statistics

2010-07-26 Thread Sam Mason
think it is. tup_returned gives the number of tuples read during sequential scans, so you've probably got some queries that are touching many more rows than you're expecting. -- Sam http://samason.me.uk/ -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes

Re: [GENERAL] Create table if not exists ... how ??

2010-07-20 Thread Sam Mason
syntax_error_or_access_rule_violation or transaction_rollback. -- Sam http://samason.me.uk/ -- 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] pg_dump and --inserts / --column-inserts

2010-07-19 Thread Sam Mason
be determined. -- Sam http://samason.me.uk/ -- 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] index scan and functions

2010-07-19 Thread Sam Mason
it as STABLE would cause PG to do what you're expecting. More details here: http://www.postgresql.org/docs/current/static/xfunc-volatility.html -- Sam http://samason.me.uk/ -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http

Re: [GENERAL] Want to schedule tasks for the future

2010-07-07 Thread Sam Mason
you when the first item to be delivered changes. I'd still be tempted to keep the waiting outside the database. -- Sam http://samason.me.uk/ -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql

Re: [GENERAL] [SOLVED] Rules in views, how to?

2010-07-06 Thread Sam Mason
have some strange side effects. You may also want to consider a UNIQUE constraint on the username (and maybe email) fields as well, especially as you've said they should be able to be used to uniquely determine a user. -- Sam http://samason.me.uk/ -- Sent via pgsql-general mailing list (pgsql

Re: [GENERAL] [SOLVED] Rules in views, how to?

2010-07-06 Thread Sam Mason
to the previous version of the row and NEW refers to the new version of the row, you can use as many or few of the columns as you want. -- Sam http://samason.me.uk/ -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org

Re: [GENERAL] SQL Query Help Please !

2010-07-06 Thread Sam Mason
: SELECT closedate, status, NT028-NT031 AS diff FROM ( SELECT closedate,status, SUM(CASE WHEN ... ... GROUP BY closedate, status) x; -- Sam http://samason.me.uk/ -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http

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

2010-07-05 Thread Sam Mason
SPI_getvalue to actually get the count out. You could probably steal some code from: http://developer.postgresql.org/pgdocs/postgres/spi-examples.html -- Sam http://samason.me.uk/ -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription

Re: [GENERAL] Out of memory on update of a single column table containg just one row.

2010-07-05 Thread Sam Mason
with, so which is better is very use case dependent. -- Sam http://samason.me.uk/ p.s. the legalese at the bottom of your emails is probably dissuading a number of people from replying, you're better off dumping it if you can--it serves no useful purpose anyway. -- Sent via pgsql-general mailing

Re: [GENERAL] how to remove a for-loop from programming language and put it into the query?

2010-07-05 Thread Sam Mason
ON: SELECT DISTINCT ON (hardware_id) hardware_id, diag_value, ts FROM diagnose_logs WHERE ts = '2009-12-25 23:59:59' ORDER BY hardware_id, ts DESC; You can obviously put in the normal clauses to limit the hardware_ids to be things you consider important in the normal ways. -- Sam http

Re: [GENERAL] how to remove a for-loop from programming language and put it into the query?

2010-07-05 Thread Sam Mason
On Mon, Jul 05, 2010 at 12:44:55PM -0300, Pedro Zorzenon Neto wrote: Em 05-07-2010 12:22, Sam Mason escreveu: SELECT DISTINCT ON (hardware_id) hardware_id, diag_value, ts FROM diagnose_logs WHERE ts = '2009-12-25 23:59:59' ORDER BY hardware_id, ts DESC; It worked ok! your

Re: [GENERAL] moderninzing/upgrading mail list format

2010-07-05 Thread Sam Mason
/pgsql.general/topics Markmail is also quite good for some things: http://markmail.org/search/?q=list:org.postgresql.pgsql-general -- Sam http://samason.me.uk/ -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org

Re: [GENERAL] Find users that have ALL categories

2010-07-01 Thread Sam Mason
do you think otherwise? If the (user_id,category_id) combination isn't unique, it's easy to change the HAVING clause into HAVING COUNT(DISTINCT category_id) = 3. -- Sam http://samason.me.uk/ -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your

Re: [GENERAL] Prevent characters not transposable to LATIN9

2010-07-01 Thread Sam Mason
routines. Something like: col = convert_from(convert_to(col, 'LATIN9'),'LATIN9') as the check constraint, or its inverse as the where clause for the erroneous rows? -- Sam http://samason.me.uk/ -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your

Re: [GENERAL] Prevent characters not transposable to LATIN9

2010-07-01 Thread Sam Mason
On Thu, Jul 01, 2010 at 04:53:51PM +0200, Arnaud Lesauvage wrote: Le 1/07/2010 16:48, Sam Mason a écrit : How about using the built in character conversion routines. Something like: col = convert_from(convert_to(col, 'LATIN9'),'LATIN9') as the check constraint, or its inverse

Re: [GENERAL] Easy way to convert a database from WIN1252 to UTF8?

2010-07-01 Thread Sam Mason
the right thing when you import it back into a UTF8 database. -- Sam http://samason.me.uk/ -- 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] Easy way to convert a database from WIN1252 to UTF8?

2010-07-01 Thread Sam Mason
On Thu, Jul 01, 2010 at 09:47:03AM -0700, Mike Christensen wrote: On Thu, Jul 1, 2010 at 9:44 AM, Sam Mason s...@samason.me.uk wrote: On Thu, Jul 01, 2010 at 09:31:12AM -0700, Mike Christensen wrote: Then, I edited the file in Notepad and saved it as UTF8 which also appears to have worked

Re: [GENERAL] Easy way to convert a database from WIN1252 to UTF8?

2010-07-01 Thread Sam Mason
from Win1252 to UTF8 external to PG and then not telling it that you'd done that. -- Sam http://samason.me.uk/ -- 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] Postgresql partitioning - single hot table or distributed

2010-06-30 Thread sam mulube
in place actually give you? Thanks for the reply. Sam On 30 June 2010 02:39, Vick Khera vi...@khera.org wrote: On Tue, Jun 29, 2010 at 4:00 PM, sam mulube sam.mul...@gmail.com wrote: Alternatively we wondered about partitioning by the server_id foreign key, using for example the modulo

Re: [GENERAL] Filtering by tags

2010-06-30 Thread Sam Mason
want to limit things a bit by only working with one contact or segment type at a time. Hope that gives you a few ideas! -- Sam http://samason.me.uk/ -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref

Re: [GENERAL] No quotes in output of psql \copy CSV

2010-06-29 Thread Sam Mason
the programs I've tried to use the resulting files with have been fine with it. If you really want all values to be quoted you can include the FORCE QUOTE option, i.e: copy (SELECT 1 AS a, 'a' AS b) TO stdout WITH CSV HEADER FORCE QUOTE a,b; -- Sam http://samason.me.uk/ -- Sent via pgsql

[GENERAL] Postgresql partitioning - single hot table or distributed

2010-06-29 Thread sam mulube
be the better choice. The single hot table getting most of the inserts, which might mean any indexes are fully in memory, or dividing the writes more evenly over all of our partitions? Many thanks for any advice. Sam -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make

[GENERAL] how to create an admin user for restore database.

2010-06-22 Thread Sam Wun
pgadmin in windows and login as user liferayadmin, from the tools menu, the restore command is disabled. I think the user liferayadmin does not have the privilege to restore database. How can I enable a user with restore permission? Your help is very much appreciated Thanks Sam -- Sent via pgsql

Re: [GENERAL] how to create an admin user for restore database.

2010-06-22 Thread Sam Wun
'); 03:14:50,608 WARN [DBUtil:474] ERROR: permission denied for relation quartz_locks: insert into QUARTZ_LOCKS values('MISFIRE_ACCESS'); ... How can I assigne admin permission to liferayadmin user? Thanks sam On Wed, Jun 23, 2010 at 12:24 PM, Adrian Klaver adrian.kla...@gmail.com wrote

Re: [GENERAL] Partial indexes instead of partitions

2010-06-14 Thread Sam Mason
and move them over into a day table at night (or whenever is better). It would be a good time to cluster the data, if that would help as well. -- Sam http://samason.me.uk/ -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http

Re: [GENERAL] [SQL] Difference between these two queries ?

2010-06-06 Thread Sam Mason
, the query planner knows that they are equivalent and will choose from the same types of plans. I.e. it's just a syntax issue, do whichever you think is prettier, the semantics are the same. -- Sam http://samason.me.uk/ -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org

Re: [GENERAL] Is it possible to make the order of output the same as the order of input parameters?

2010-06-02 Thread Sam Mason
just need to make the order explicit: SELECT c.* FROM customer c, (VALUES (1,23), (2,56), (3, 2), (4,12), (5,10)) x(ord,val) WHERE c.id = x.val ORDER BY x.ord; -- Sam http://samason.me.uk/ -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make

Re: [GENERAL] Is it possible to make the order of output the same as the order of input parameters?

2010-06-02 Thread Sam Mason
this fun; here's another version using window functions (from PG 8.4 onwards) this time: SELECT c.* FROM customer c, ( SELECT *, row_number() OVER () FROM (VALUES (23), (56), (2), (12), (10)) x) x(val,ord) WHERE c.id = x.val ORDER BY x.ord; -- Sam http://samason.me.uk

Re: [GENERAL] Is it possible to make the order of output the same as the order of input parameters?

2010-06-02 Thread Sam Mason
On Wed, Jun 02, 2010 at 04:47:01PM +0200, A. Kretschmer wrote: In response to Sam Mason : SELECT c.* FROM customer c, ( SELECT *, row_number() OVER () FROM (VALUES (23), (56), (2), (12), (10)) x) x(val,ord) WHERE c.id = x.val ORDER BY x.ord; Wow, that's really cool

Re: [GENERAL] Hiding data in postgresql

2010-05-25 Thread Sam Mason
* be possible to say that no useful data can be transmitted, but that's about it. If somebody just wants to leak a password/private key a surprisingly few number of bits will go a long way. -- Sam http://samason.me.uk/ -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make

Re: [GENERAL] How to lose transaction history (xmin values, WAL, etc.)?

2010-05-21 Thread Sam Mason
compromised, what would stop the attacker from inserting some code that records the responses from this external key store? -- Sam http://samason.me.uk/ -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref

  1   2   3   4   5   6   7   8   9   >