> test_1
> test2
> test_2
> test3
> test_3
> (6 rows)
>
And this one looks like C:
> mydb=# select * from test order by felt1;
> felt1
> test1
> test2
> test3
> test_1
> test_2
> test_3
> (6 rows)
--
Gregory Stark
Enterp
like ROLLUP except that it does it on every possible
axis. It's normally used in reporting tools.
If that's what you're looking for then afaik there's no module to do this in
Postgres. Sorry.
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster
ple's desks -- a tall order for an SQL query.
In short primary keys that aren't static just aren't very useful.
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
---(end of broadcast)---
TIP 1: if posti
ur C trigger function? How is it constructing the original varchar datum and
doing the insert?
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an a
PI_ERROR_NOATTRIBUTE which is -9.
That said if your function is a function which takes PG_FUNCTION_ARGS then the
right way to return NULL is with PG_RETURN_NULL(). Merely returning a
PointerGetDatum(NULL) isn't good enough.
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.co
om a Postgres float8 datum to an actual double you can just call
the macros DatumGetFloat8 and Float8GetDatum. This makes your code depend on
the internal representation of float8 as a C double but it's better than the
alternative.
--
Gregory Stark
EnterpriseDB
that if you're one of the people who use replication to
move the data to a reporting database which has a modified schema appropriate
for the different usage? This improvement would make it useless for that
purpose.
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
;
> The result is displayed and the debugger doesn't stop at the breakpoints.
Are you sure you're attaching to the right process?
One way to do it is to run select pg_backend_pid() from psql and attach to
that pid.
--
Gregory Stark
EnterpriseDB http://www.enterp
lumn in that
table which is a foreign key reference to man_id?
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
---(end of broadcast)---
TIP 4: Have you searched our list archives?
http://archives.postgresql.org/
b (i integer references a(i));
ERROR: there is no unique constraint matching given keys for referenced table
"a"
However if you ever update or delete the referenced records then it also helps
performance to have an index on the referencing column which Postgres doesn't
enforce.
--
HERE clauses treat NULL the same as they treat
FALSE, ie, they exclude the row. But unless you can come up with a way for a
SELECT clause to not tell you whether it's including a row or not (ie, whether
it includes the row is "unknown") then it's got to pick one or the othe
you
keep this data around for a long time you might actually be better off since
you could use a real non-temporary table and not be forced to keep around
transactions for long periods of time tying up other resources.
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
k_mem"
This comment actually refers to a new optimization which isn't in the released
8.2 yet. It introduces a Materialize node above a sort to allow the sort to
skip the final merge step. Instead it merges as the query runs and the
Materialize throws away data which isn't n
o? Is that insert the *only* DML
you're executing? No updates or deletes?
What do you mean by saying it deadlocks? Do you get a transaction abort with
an error about a deadlock detected? Or do you just mean it freezes?
--
Gregory Stark
EnterpriseDB http:
ossible for two inserts on the same table to deadlock against each
other so there must be more going on than what you've described. It's hard to
help much without a complete picture.
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
---
from a sample is actually a
pretty hard problem. How many distinct values do you get when you run with
enable_hashagg off?
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
---(end of broadcast)---
TIP 1: if posting/reading th
-a in
the same environment as the server? Either by starting the server in shell
manually or by putting ulimit -a in the startup script which starts the server
if you have one?
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
---(end of
128M but the error just means it tried
to allocated 128M and failed, it may already have allocated 400M and been
trying to go over the 524M mark.
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
---(end of broadcast)---
T
,257,98968,98969,98970,98971)
> 2007-06-14 19:50:35 EDT LOG: disconnection: session time: 0:00:13.810
> user=spam database=spam host=127.0.0.1 port=38126
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster
HERE id NOT IN (select id from history);
DELETE from history WHERE seen < now()-'3 days'::interval;
END;
This could still deadlock so it may make sense for it to do it in a
transaction and add LOCK TABLE statements to lock the tables which refer to
the tokens table.
"Francisco Reyes" <[EMAIL PROTECTED]> writes:
> Gregory Stark writes:
>
>> You're right that your limit is above 128M but the error just means it tried
>> to allocated 128M and failed, it may already have allocated 400M and been
>> trying to go ove
could have drivers for GPUs, or perhaps also for various other kinds of
coprocessors available in high end hardware.
I wonder if it exists already though.
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
---(end of broadcast)
some kind of kernel driver which took care of managing the shared resource
(like the kernel manages things like disk, network, memory, etc) and either
that or a library layer would provide an abstract interface so that the
Postgres code would be hardware independent.
--
Gregory
x would report it as a SIGKILL.
What does dmesg say, it doesn't have any OOM messages does it?
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an
u can normalize "on-the-fly" using an expression index as long as
your function always returns the same data given the same inputs (and is
therefore marked "immutable").
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
---(end of broadcast)---
TIP 6: explain analyze is your friend
so send
that along and at least we'll know which table or index has the corrupted
data. You probably don't want to do this during peak production time though...
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster
in the same transaction.
You could probably fix this particular problem by reindexing the corrupted
index. But you may never know if some of the data is incorrect.
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
---(end of broadcast)-
nt accesses to it.
huh? no, sequences don't require this. They would be pointless if they did.
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
---(end of broadcast)---
TIP 1: if posting/reading through Usenet, plea
7;m still lost. I can see how it would be hard to join these together but I'm
not sure what result I would be after.
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster
curious exactly what's going on and how to optimize
your table layout send your table definition and we can tell you exactly how
it's being laid out and where the extra 4 bytes are going.
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
<[EMAIL PROTECTED]> writes:
> Gregory Stark <[EMAIL PROTECTED]> wrote:
>> This could also be due to alignment restrictions on the other columns or the
>> row as a whole. If you're curious exactly what's going on and how to optimize
>> your table layout
subselects I would worry a
little about the optimizer rerunning them unnecessarily.
Perhaps coalesce(greatest(a,b), coalesce(a,b)) is more legible?
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
---(end of broadcast)---
TIP 1:
off a lot of people. I think it now prints the warning
and the result set.
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
---(end of broadcast)---
TIP 9: In versions below 8.0, the planner will ignore your desire to
;s new behavior relate to the standard moving?
Sorry I noticed that editing error only after I sent it. I should have changed
that to say Oracle was moving in that direction. There's nothing of the sort
in SQL2003 that I can find.
--
Gregory Stark
EnterpriseDB http://www.ent
"Tom Lane" <[EMAIL PROTECTED]> writes:
> Gregory Stark <[EMAIL PROTECTED]> writes:
>> "Bruno Wolff III" <[EMAIL PROTECTED]> writes:
>>> Also what value should I have used in a coalesce to guaranty still getting
>>> the maximum?
>
54PM +0400, Viatcheslav Kalinin wrote:
>
> # select start_date from show_date
> # order by
> # case when start_date > CURRENT_DATE then start_date end desc,
> # case when start_date <= CURRENT_DATE then start_date end asc;
This is two sorting expressions, one of whi
you're not. Postgres 8.3 won't even be released for a few more months!
Perhaps that's 8.2.4?
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
---(end of broadcast)---
TIP 4: Have you searched our list archives?
http://archives.postgresql.org/
ur rows are twice as big it will take twice as much i/o
to read and it will take twice as long.
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
---(end of broadcast)---
TIP 5: don't forget to increase your free space map settings
checking every row, not once per
session. And it wouldn't stop selects.
I think what you really want is a ON CONNECT trigger for this.
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
---(end of broadcast)---
TIP 9
I would not consider it until it was actually a problem.
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail com
Clustered tables of the type you're imagining aren't really supported in
Postgres at all. What Postgres does is reorder the table in place but the
index is still stored separately. The patch you refer to here would help keep
the table in order as updates and inserts happen which
ly static.
So perhaps it would be useful.
There is something in the standard called Assertions which I think are
supposed to address this issue. But they're "hard" and I don't know if any
database supports them. I wonder if we did whether anyone would find them
useful.
--
G
things in the past but you should think hard
about whether you can't normalize your data further to avoid this. It will
make querying your data later much easier. (Think of what your joins are going
to look like.)
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
7; upon a successful insert and 'failure' if
> insert fails.
You need an EXCEPT WHEN clause, see:
http://www.postgresql.org/docs/8.2/interactive/plpgsql-control-structures.html#PLPGSQL-ERROR-TRAPPING
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
our own. And the cool thing is some
people already have rolled their own and they'll just magically see an
improvement. They don't have to do anything they weren't doing already to turn
it on.
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
-
"Bruce Momjian" <[EMAIL PROTECTED]> writes:
> They could roll their own a lot easier if you had finished the psql
> concurrent patch.
I did. But you decided you didn't want it.
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
---
uggest calling index organized tables
since that's effectively what they are).
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
---(end of broadcast)---
TIP 4: Have you searched our list archives?
http://archives.postgresql.org/
re were no
share locks on records.)
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED
7;ve simplified away the mistake in your code. Have you actually
tried the above code? Send an actual example and describe what actually
happens.
The only thing I wonder about is whether you're compiling with optimizations
and without -fno-strict-aliasing which may be necessary for Postgres
show the right value in that
> column. Once again, looking at the query logs, there are no conflicting
> updates happening.
You'll have to describe in much more detail what you're doing. Send the actual
session from your terminal of this happening, for example.
--
Gregory Star
t's an ascii character) and has 4-byte alignment. In 8.3 it's 2-5
bytes (2 bytes if it's an ascii character) and has 1-byte alignment.
If you declare a column as "char" with the quotes then it's a 1-byte integer
with 1-byte alignment. That'll be smaller than sm
nd argument type(s). You might need
to add explicit type casts.
In fact it's not clear what you would want to happen here. Should it cast the
text to an integer and use integer comparison or cast the integer to text and
use text comparison? They don't necessarily generate the same result
t all, there are no "actual" values. And b) there's no explanation
for why the estimates should be different for this query than the previous,
identical, query.
Send along the actual psql session, not an edited version.
--
Gregory Stark
EnterpriseDB http://www.enterp
-
Seq Scan on foo (cost=0.00..1681.00 rows=1 width=5) (actual
time=0.147..281.349 rows=1 loops=1)
Filter: ((i)::text = '17'::text)
Total runtime: 281.448 ms
(3 rows)
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
---(end of b
grabbed"
them. Commit that. then go back and process them. Then go back and update them
again to delete them. But then you need some facility for dealing after a
crash with finding grabbed records which were never processed.
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.
obably it would have to run an SPI query to use the planner to find the best
way to get the rows it wants.
Another problem is that presumably you're reindexing because the existing
index *isn't* in such good shape. You may even be doing it because the
existing index is
ding it in a random access order which is slower and also
means potentially reading parts of it many times over before you're done.
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
---(end of broadcast)---
TIP 3: Have you checked our extensive FAQ?
http://www.postgresql.org/docs/faq
read (slowly -- it's pretty dense stuff) through
src/backend/utils/time/tqual.c:HeapTupleSatisfiesMVCC()
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
---(end of broadcast)---
TIP 9: In versions below 8.0, the planner will ignore y
But once you run vacuum that value will be changed. It represents the oldest
transaction id which can occur in the table. Every time vacuum runs if that
transaction is too old it will try to move it forward.
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
-
"Alvaro Herrera" <[EMAIL PROTECTED]> writes:
> Gregory Stark wrote:
>
>> > Just for confirmation: the relfrozenxid of a fresh table is the xid of the
>> > transaction that created it, isn't it?
>>
>> Yes, easily enough checked:
>&g
uum if you want to
run vacuum manually faster than the normal autovacuum times.
http://www.postgresql.org/docs/8.2/interactive/runtime-config-resource.html#RUNTIME-CONFIG-RESOURCE-VACUUM-COST
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
---(end
PDATE chain following, catalog
checks (generally you can use an index or table which has been committed even
if it was committed after you started your transaction), relational integrity
checks, and other special cases like those.
--
Gregory Stark
EnterpriseDB http://www.enterpris
wn where they come from.
I'm unclear why you would be running the enterprise management tools on
individual machines though. Isn't the point of enterprise management tools
that you can manage the whole enterprise? Ie, that they work remotely?
--
Gregory Stark
set of operators which can be optimized by an
index organized the same way and usually correspond to a particular
interpretation of the data type.
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
---(end of broadcast)---
TIP 1:
perator
classes. There are a bunch more in the contrib modules. But I don't see any
related to temporal data.
You might want to look at the seg module and see if it can be altered to work
with temporal data instead. You might also look on Pgfoundry, there might be
something there.
--
Gre
with hundreds of
columns, but that's just guessing in the dark without actual facts to look at.
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
---(end of broadcast)---
TIP 4: Have you searched our list archives?
http://archives.postgresql.org/
-> Seq Scan on tbl_filetype_suffix
(cost=1.00..10001.34 rows=14 width=8) (actual time=0.133..0.176
rows=14 loops=1)"
" Filter: (filetype_suffix_index IS
TRUE)"
--
Gregory Stark
EnterpriseDB
fully the line breaks are gone. I couldn't find any
> in my sent mail.
No, the double-quotes are gone but the lines are still wrapped. It's become
quite a hassle recently to get mailers to do anything reasonable with code.
--
Gregory Stark
EnterpriseDB
h this one?
What does the output of "vacuum verbose" say?
> If you have adequate disk space free (enough to hold another
> copy of the new table) and the table has an index on it, then
> CLUSTER the table.
Or you can use ALTER TABLE to change the type of a column which forces the
w
"novnov" <[EMAIL PROTECTED]> writes:
> Is there any plan to add such a capability to postgres?
It's been talked about. I wouldn't be surprised to see it in 8.4 but nobody's
said they'll be doing it yet and there are a lot of other more exciting ideas
t
=) "worker""
This says you mistyped the constraint above to refer to tasks(worker) instead
of users(id). Did you?
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
---(end of broadcast)---
TIP 6: explain analyze is your friend
Sorry, I reread your original post. My initial reading was wrong.
To make this work I think you'll need to set these constraints to be deferred.
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
---(end of broadcast)--
"Pavel Stehule" <[EMAIL PROTECTED]> writes:
> 2007/8/11, Gregory Stark <[EMAIL PROTECTED]>:
>>
>> "Pavel Stehule" <[EMAIL PROTECTED]> writes:
>>
>> > checked_by INT REFERENCES users (id) ON UPDATE CASCADE ON DELETE SET
>
AIL: Failed on request of size 67108860.
> --
>
> My postgresql.conf is below. I am on a Dual Core server with 4GB or
> RAM, which runs MySQL as well (key_buffer for which is at around
> 800M).
What version of Postgres is this?
--
Gregory Stark
EnterpriseDB http:
"Lim Berger" <[EMAIL PROTECTED]> writes:
> On 8/13/07, Gregory Stark <[EMAIL PROTECTED]> wrote:
>> "Lim Berger" <[EMAIL PROTECTED]> writes:
>>
>> > Hi
>> >
>> > I am getting the following error while running querie
likes to do it whenever 10% of the table has been updated, but
your mileage will vary considerably depending on how much your updates or
other DML affects the distribution which the queries are depending on.
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
27;N'::bpchar
>
> Indexes:
> "cachedstats_pkey" PRIMARY KEY, btree (id)
> "idx_cachedstats_unique_prof_name" UNIQUE, btree (alias)
What's "alias"?
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
---(end of broadcast)---
TIP 6: explain analyze is your friend
n the fly.
You could look at the CONVERT function which might help, but I'm not sure
exactly what you would have to do to solve your immediate problem.
If you really need multiple collations in a single database there's a function
pg_strxfrm() which was posted to this list a long
happen if an error occurs. Group together into a single
transaction precisely the changes that you want to be committed together or
rolled back together. Don't structure your program around the performance
issues.
For the remaining questions I would say you need to experiment. Perhaps others
will
ons like
that is if you're processing a batch data load of some kind. In that case you
have a large volume of updates and they're all single-threaded. But usually in
that case you want to abort the whole load if you have a problem.
--
Gregory Stark
EnterpriseDB http://w
architecture. There's no magic here, more bytes take more
blocks of space which take more time to write or read.
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
---(end of broadcast)---
TIP 4: Have you searched our list archives?
http://archives.postgresql.org/
lters that eat pets and small
> children ... so if you want to be sure to get through to me, don't forget to
> cc: the list.
They eat all my emails, but I'm sure that's intentional :)
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
---(end of broadcast)---
TIP 3: Have you checked our extensive FAQ?
http://www.postgresql.org/docs/faq
ou cannot manipulate the whole
thing in memory all at once (Keep in mind that Postgres expects to be able to
handle a few copies of the data at the same time. Conservatively expect 5
simultaneous copies to have to fit in memory.) then you'll have to look into
the large object interface which is
o build some kind of index to help the ~* clause. If
you do a lot of queries like that and the id,s_id restriction isn't very
selective you might look into tsearch2 which can index that type of query.
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
---(end of broadcast)---
TIP 4: Have you searched our list archives?
http://archives.postgresql.org/
conditions is
> infinite...
Depends on the "conditions" bit. You can't solve all of the infinite
possibilities -- well you can, just run the query above -- but if you want to
do better it's all about understanding your data.
--
Gregory Stark
EnterpriseDB h
in the table... that's what it's meant to do.
LIMIT
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
---(end of broadcast)---
TIP 3: Have you checked our extensive FAQ?
http://www.postgresql.org/docs/faq
d it has to create and delete entries in pg_class for
every use.
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-n
led "autonomous
transactions" and there's no built-in support for them in Postgres but you can
put together something equivalent using dblink or a second client connection.
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
---(end of br
"Tyson Lloyd Thwaites" <[EMAIL PROTECTED]> writes:
> Gregory Stark wrote:
>
>>"Tyson Lloyd Thwaites" <[EMAIL PROTECTED]> writes:
>>
>>>Normally if we catch the exception, other dbs (Oracle, MSSQL) will let us
>>>keep going.
>
I would suggest vacuuming between each update.
I do have to wonder how you're getting the data *in* though. If it's large
enough to have to stream out like this then how do you initially load the
data?
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
---
based on
> bytea parameter size. Or even writing a trigger issuing ALTER TABLE
> depending on size of insert ?
I wouldn't suggest doing that. It will bloat the pg_attribute catalog table
and require a lot of extra vacuums. I think it would also create some lock
contention issues.
--
stem backup?
Can you do \ds on the working and non-working database and compare the
results?
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
---(end of broadcast)---
TIP 9: In versions below 8.0, the planner will ignore your des
o on.
It's purely a question of which API we use to create the threads of execution.
Not an architectural change in Postgres.
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
---(end of broadcast)---
TIP 6: explain analyze is your friend
latively trivial as there are
already some configurations where it's not the case (the EXEC_BACKEND case I
believe). The rest of the system uses a shared memory base pointer and
references everything relative to that.
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
--
file handling records one by one and waiting for each commit
before proceeding then it's single threaded. If you have a hundred independent
clients on separate connections doing separate things then each one of them
could get 6tps. Which you have will depend on your application and your n
gt; use regular pointers, and have for years.
Ah, I happened to be recently in that code so I was mislead.
So even in EXEC_BACKEND we require that we can attach to the shared memory at
a specified location. hm.
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
--
"Tom Lane" <[EMAIL PROTECTED]> writes:
> Gregory Stark <[EMAIL PROTECTED]> writes:
>> "Tom Lane" <[EMAIL PROTECTED]> writes:
>>> There are a few old bits of code that still use MAKE_PTR/MAKE_OFFSET,
>>> but I think it's mo
ould set up a trigger to generate the tsvector when you first load the
data instead of adding it later.
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send
and a CRC will happily checksum the corrupted memory
just fine. A checksum is no guarantee. But I've also seen data corruption
caused by bad memory in an i/o controller, for example. There are always going
to be cases where it could help.
--
Gregory Stark
EnterpriseDB htt
ing precomputed function values are discarded. The trigger you
> suggest is fairly pointless because it will not cause regeneration of
> plans.
The trigger would alert him if there were any indexes built using the
function...
--
Gregory Stark
EnterpriseDB http
1 - 100 of 385 matches
Mail list logo