Thread: transactions

transactions

From
Timur Irmatov
Date:
Hello!

I develop a web-site with cgi-s written in perl, which access
PostgreSQL database..

In my scripts I have a sequence of selects.

Is it faster to wrap them all in transaction ?

Thanks in advance.
Timur.


Re: transactions

From
dima
Date:
> In my scripts I have a sequence of selects.
> Is it faster to wrap them all in transaction ?
for sure



Re: transactions

From
Jan Wieck
Date:
Timur Irmatov wrote:
>
> Hello!
>
> I develop a web-site with cgi-s written in perl, which access
> PostgreSQL database..
>
> In my scripts I have a sequence of selects.
>
> Is it faster to wrap them all in transaction ?

Not only is it faster, it gives you the advantage of MVCC too,
presenting you a snapshot of the database. So no concurrent
UPDATES done by someone else are visible to you.


Jan

--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being
right. #
# Let's break this rule - forgive
me.                                  #
#==================================================
JanWieck@Yahoo.com #

XML and PostgreSQL

From
Dan Ostrowski
Date:
I am wondering if any of you work with XML-PostgreSQL extensively.

I usually do presentations in HTML for web stuff, but I am now about to
embark on a large ( for me ) project with potentially many layers of
presentation and data manipulation.

I am wondering how well PostgreSQL deals with XML and whether, in your
optinions, it is worth trying to learn a decent amount of XML to
accomodate this project. It's going to be quite long anyhow, since i am
doing it pretty much pro-bono and by myself, so a little research time might be alright if the advantages are great
enough.

thoughts?

regards,
dan

Re: XML and PostgreSQL

From
Elaine Lindelef
Date:
>I am wondering if any of you work with XML-PostgreSQL extensively.
>
>I usually do presentations in HTML for web stuff, but I am now about to
>embark on a large ( for me ) project with potentially many layers of
>presentation and data manipulation.
>
>I am wondering how well PostgreSQL deals with XML and whether, in your
>optinions, it is worth trying to learn a decent amount of XML to
>accomodate this project. It's going to be quite long anyhow, since i am
>doing it pretty much pro-bono and by myself, so a little research
>time might be alright if the advantages are great enough.
>
>thoughts?
>
>regards,
>dan

I consider XML to be rather a mixed bag. The idea is very powerful,
and very useful. The standard as it's evolving is almost becoming too
complex to be useful.

We work with XML extensively as part of an interchange format.
However, if I was building my own application that would not be
communicating with other people outside my control I would not use
strict XML but instead an XML-like construct.

True XML is an enemy of concise and rational data design. It can get
rather ridiculous with the possible levels of data... where a simple
title might need to have 0 to 4 pieces of assorted metadata about it
(language, country, etc) and where you have to accomodate possible
multiple titles per item even though in practice you'll never want
more than one title. Each of these fields ends up needing its own
table, which makes for a huge explosion of data tables. (This is
where I miss PostgreSQL's lack of database "users" as is available in
Oracle and MySQL.) If you have control over the XML that needs to go
in and out of your database, these problems can be ignored in places
which makes XML quite a bit more interesting.

XML can be used to exchange data with a Flash front end, which is convenient.

I don't find XML useful for data manipulation. And I don't see really
that XML has an advantage over a SQL database in terms of splitting
data presentation layers from data: the database is infinitely more
flexible, rational, and comprehensible. XML is useful as a step past
tab-delimited files for sharing data between systems.

My feeling is that there is not really good support for
XML-PostgreSQL connections yet, but that this is similarly true for
other databases. There are libraries in Perl and the like that can be
used to put it together.

So, as always: it depends on your application. ;^)

Elaine Lindelef


Re: XML and PostgreSQL

From
Jeff Davis
Date:
What do you plan to do with the XML, and how do you envision the database as a
part of that plan?

It seems like anything you'd like to do with XML in postgres you could do with
some custom types, and some stored procedures. I think that could be helpful
because you could, for example, query based on an XML element within an
attribute of a relation.

You could even share the functions, if you were so inclined.

One thing to keep in mind is that an XML document could be structured very
differently from another XML document. If you did want to store XML documents
in postgres, and you wanted to query and manipulate them inside the database,
they'd need to have a definate structure for documents within an attribute.

You can also, of course, just store the XML document in a text field and let
your app handle it.

Regards,
    Jeff



On Wednesday 11 September 2002 01:33 pm, Dan Ostrowski wrote:
> I am wondering if any of you work with XML-PostgreSQL extensively.
>
> I usually do presentations in HTML for web stuff, but I am now about to
> embark on a large ( for me ) project with potentially many layers of
> presentation and data manipulation.
>
> I am wondering how well PostgreSQL deals with XML and whether, in your
> optinions, it is worth trying to learn a decent amount of XML to
> accomodate this project. It's going to be quite long anyhow, since i am
> doing it pretty much pro-bono and by myself, so a little research time
> might be alright if the advantages are great enough.
>
> thoughts?
>
> regards,
> dan
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html


Re: XML and PostgreSQL

From
Ewald Geschwinde
Date:
Dan Ostrowski wrote:

>I am wondering if any of you work with XML-PostgreSQL extensively.
>
>I usually do presentations in HTML for web stuff, but I am now about to
>embark on a large ( for me ) project with potentially many layers of
>presentation and data manipulation.
>
>I am wondering how well PostgreSQL deals with XML and whether, in your
>optinions, it is worth trying to learn a decent amount of XML to
>accomodate this project. It's going to be quite long anyhow, since i am
>doing it pretty much pro-bono and by myself, so a little research time might be alright if the advantages are great
enough.
>
>thoughts?
>
>regards,
>dan
>
>---------------------------(end of broadcast)---------------------------
>TIP 5: Have you checked our extensive FAQ?
>
>http://www.postgresql.org/users-lounge/docs/faq.html
>
>
>
>
Why don't you just use the new ltree in contrib. I think this is the
best solution for working with XML-documents and store them in postgresql

Have a look at it.

http://www.sai.msu.su/~megera/postgres/gist/ltree/

Ewald Geschwinde