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

2017-10-16 Thread Sam Gendler
levate their role first, in which case reassign owned will come in handy 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 > 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 createrol

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 wrote: > Jeff Janes writes: > > On Wed, May 24, 2017 at 1:42 PM, Sam Saffron > wrote: > >> I have this query that is not picking the right index unless I hard code > >> dates:

[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 loop

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

2015-02-04 Thread Sam Saffron
(4 rows) I need 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 wrote: > On Tue, Feb 3, 2015 at 11:28 PM, Sam Saffron wrote: >> >> Note: I still consider this a bug/missing feature of sorts since

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, dat

[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_a

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 wrot

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

2014-11-13 Thread Sam Saffron
he.c', I thought that the decision of the plan to use was purely based on the value sent in to the prepared query. However it seems that the planner completely ignores the value in some steps. (so, for example I was thinking that "aaa" and "ccc" would result in completely diff

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

2014-11-13 Thread Sam Saffron
essage(conn)); PQclear(res); exit_nicely(conn); } PQclear(res); } finish = get_wall_time(); fprintf(stderr, "raw %f \n", (finish-start)); /* close the connection to the database and cleanup */ PQfinish(conn); return 0; } ``` Results: ```text sam@ubuntu

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@post

Re: [GENERAL] PgAdmin errors

2014-03-26 Thread Hall, Samuel L (Sam)
ierce Sent: 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 ? --

Re: [GENERAL] PgAdmin errors

2014-03-26 Thread Hall, Samuel L (Sam)
t: Re: [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_hi

[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 erro

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 wrote: > On 03/25/2014 05:03 PM, Sam Saffron wrote: >> >

Re: [GENERAL] Failure upgrading PG 9.2 to 9.3

2014-03-25 Thread Sam Saffron
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. &

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 wrote: > Sam Saffron writes: >

[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 (9.2.8

[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 cop

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) > > >

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) mailto:sam.h...@alcatel-lucent.com

[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 + pubacc_lo.

[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 t

[GENERAL] Finding the synchronous slave after a master crash

2013-06-18 Thread Sam Crawley
sure that a new 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 Cra

[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: cmd.Parameter

[GENERAL] Estimated rows question

2012-08-21 Thread Sam Ross
inery exists 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

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 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

[GENERAL] efficiency of wildcards at both ends

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

Re: [GENERAL] Is it even possible?

2012-03-21 Thread Sam Loy
nd created a postgis 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 Winwo

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

[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 post

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

2012-03-04 Thread Sam Wong
MODE - 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

Re: [GENERAL] JDBC Connection Errors

2011-08-23 Thread Sam Nelson
m 303-955-0509 === On Tue, Aug 23, 2011 at 5:46 PM, Adrian Klaver 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

[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 ev

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 ls

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? -Origin

Re: [GENERAL] dblink() from GridSQL

2011-05-05 Thread Sam Nelson
n Moncure wrote: > >> On Thu, May 5, 2011 at 12:13 PM, Sam Nelson >> 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 >&g

[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 see

Re: [GENERAL] very basic SQL question

2010-11-23 Thread Sam Mason
27;re looking 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

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
ata) then it can be released very quickly and made available 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] Query to get the "next available" unique suffix for a name

2010-09-28 Thread Sam Mason
available username and thus suggest 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 a

Re: [GENERAL] Memory Errors

2010-09-21 Thread Sam Nelson
more info than that. We're quite busy and my ability to remember things is ... questionable. -Sam On Thu, Sep 9, 2010 at 8:14 AM, Merlin Moncure wrote: > On Wed, Sep 8, 2010 at 6:55 PM, Sam Nelson > wrote: > > Even if the corruption wasn't a result of that, we weren&#

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

2010-09-17 Thread Sam Mason
work 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.

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

2010-09-17 Thread Sam Mason
: WITH x(v) AS (VALUES (1),(2),(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 subscriptio

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 ver

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

2010-09-17 Thread Sam Mason
ge. 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] 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 TH

Re: [GENERAL] Transposing rows and columns

2010-09-16 Thread Sam Mason
it can be quite tedious if you've got lots of columns 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-

Re: [GENERAL] Need magic for identifieing double adresses

2010-09-16 Thread Sam Mason
gt; Strawberry Street > Strawberrystreet > Strawberry Str.42 > Strawberry Str. 42 > 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 somethi

Re: [GENERAL] Need magic for identifieing double adresses

2010-09-16 Thread Sam Mason
names differently. You can 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 wit

Re: [GENERAL] Post Install / Secure PostgreSQL

2010-09-13 Thread Sam Mason
bove: sudo -u postgres createuser "$USER" -- 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-08 Thread Sam Nelson
alter any data unless they ask us to), including deleting those rows. My memory 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

Re: [GENERAL] Memory Errors

2010-09-08 Thread Sam Nelson
y to remember to write back with whether or not any of those things worked. On Wed, Sep 8, 2010 at 1:30 PM, Tom Lane wrote: > Sam Nelson writes: > > pg_dump: Error message from server: ERROR: invalid memory alloc request > > size 18446744073709551613 > > pg_dump: The com

[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: pg_dum

Re: [GENERAL] joins with text search

2010-09-08 Thread Sam Mason
sing you'll still get a useful text search column. I'd also be tempted to remove the "to_tsvector" call from the part_number, as I doubt it really is an english bit of text. You can probably just use it as a tsvector literal, probably quoting it first, maybe something like:

Re: [GENERAL] Connection question

2010-09-01 Thread Sam Mason
tgreSQL 8.3.1-1 > and the applications are Java 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.

Re: [GENERAL] WAL Archive Log

2010-08-27 Thread Sam Nelson
le 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, A

[GENERAL] WAL Archive Log

2010-08-26 Thread Sam Nelson
stuck 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] Feature proposal

2010-08-26 Thread Sam Mason
en I start (by truncate) > but while the COPY is working, I see it grows (by \d+ 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

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 wrote: > Sam Nelson writes: > > Here's the output from pg_controldata: > > > $ pg_controldata `pwd` > > WARNING: Calculated CRC check

Re: [GENERAL] Missing Toast Chunk

2010-08-19 Thread Sam Nelson
if they've done anything weird with the database in the last while. Thanks for your help. -Sam On Thu, Aug 19, 2010 at 5:14 PM, Tom Lane wrote: > Sam Nelson writes: > >> It's almost certainly not ruby's fault. Have they done anything > >> strange like kill

[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 CentOS

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 wrote: > 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 > shut down? I'd tend

[GENERAL] Missing Toast Chunk

2010-08-19 Thread Sam Nelson
with Amazon EC2 and/or debian? A bug in postgres, itself? Any ideas? -Sam

Re: [GENERAL] Massively Parallel transactioning?

2010-08-19 Thread Sam Mason
rollback. Rather than being a hack, 2PC sounds like 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

Re: [GENERAL] Histogram generator

2010-07-28 Thread Sam Mason
ouping, i.e: SELECT timestamp 'epoch' + interval '1 second' * floor(date_part('epoch',foo) / (30*60)) * (30*60) AS t, COUNT(*) FROM data GROUP BY floor(date_part('epoch',foo) / (30*60)); This will save PG from converting back to a date for every

Re: [GENERAL] Server load statistics

2010-07-26 Thread Sam Mason
ow busy the server > is? Yes, but I don't think it's measuring what you 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://sam

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

2010-07-20 Thread Sam Mason
ode. So you could also use 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] index scan and functions

2010-07-19 Thread Sam Mason
n is to get its return value. I'd expect that labeling 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-g

Re: [GENERAL] pg_dump and --inserts / --column-inserts

2010-07-19 Thread Sam Mason
n't say much, but without the numbers this can't 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] Want to schedule tasks for the future

2010-07-07 Thread Sam Mason
n external process when any data exist. You could have a trigger tell 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

Re: [GENERAL] SQL Query Help Please !

2010-07-06 Thread Sam Mason
gt; For Example : > the result shoud be > Closedate , status , NT028, NT031, NT050,NT062 , NT028-NT031 Just put your code above in an "inner select", something like: SELECT closedate, status, NT028-NT031 AS diff FROM ( SELECT closedate,status, SUM(CASE WHEN ... ...

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

2010-07-06 Thread Sam Mason
ot;right thing". OLD always refers 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

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

2010-07-06 Thread Sam Mason
#x27;re doing could 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 pg

Re: [GENERAL] moderninzing/upgrading mail list format

2010-07-05 Thread Sam Mason
/group/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.postgres

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

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

2010-07-05 Thread Sam Mason
es to limit the hardware_ids to be things you consider important in the normal ways. -- 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] Out of memory on update of a single column table containg just one row.

2010-07-05 Thread Sam Mason
work with the whole thing in one go). They can be a bit of a hassle to work 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

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

2010-07-05 Thread Sam Mason
there was an error and only if it's OK can you call something like 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 li

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

2010-07-01 Thread Sam Mason
fined in Win1252. I guess you've either got other problems or this was just an artifact of converting 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] 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 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 > >> appear

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

2010-07-01 Thread Sam Mason
ich will let PG to do 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] 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'),'LATI

Re: [GENERAL] Prevent characters not transposable to LATIN9

2010-07-01 Thread Sam Mason
t using the built in character conversion 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

Re: [GENERAL] Find users that have ALL categories

2010-07-01 Thread Sam Mason
AICT, the above code will include a user with categories 1 to 4. Why 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 mail

Re: [GENERAL] Filtering by tags

2010-06-30 Thread Sam Mason
o be *slow*, so you may 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:/

Re: [GENERAL] Postgresql partitioning - single hot table or distributed

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

[GENERAL] Postgresql partitioning - single hot table or distributed

2010-06-29 Thread sam mulube
hich would 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.or

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

2010-06-29 Thread Sam Mason
hen they need to be, i.e. if they contain a quote, comma and a few other characters. This is very common behavior and all 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" op

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

2010-06-22 Thread Sam Wun
RTZ_LOCKS values('STATE_ACCESS'); 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,

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

2010-06-22 Thread Sam Wun
ayadmin; When I launched 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 ap

Re: [GENERAL] Partial indexes instead of partitions

2010-06-14 Thread Sam Mason
"levels" to your hierarchy. Maybe bi-hourly (~15 million records?) within the current day 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/ -- Se

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

2010-06-06 Thread Sam Mason
rsion 8.1 (?) and onwards, 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-gen

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.v

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
ELECT a FROM t)::integer[], 1)) > SELECT i, a[i] > FROM s CROSS JOIN t; Isn't 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), (1

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
n it be done? Yes, you 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@postg

Re: [GENERAL] Hiding data in postgresql

2010-05-25 Thread Sam Mason
nnel, and beyond some threshold it *may* 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-

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

2010-05-21 Thread Sam Mason
tabase? > > Can you use an external key store? How does this help? if the database has been 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 mai

  1   2   3   4   5   6   7   8   9   >