Re: Linked Lists example. - Mailing list pgsql-sql

From Rudi Starcevic
Subject Re: Linked Lists example.
Date
Msg-id 3F650A11.5010808@oasis.net.au
Whole thread Raw
In response to Linked Lists example.  ("Rudi Starcevic" <rudi@oasis.net.au>)
List pgsql-sql
Jesse,
>> This approach probably wouldn't work out very well if you needed to 
pull the content out of the database on every view because there are>> lots of queries and loops involved in following
thelist.
 

Yes I see. As usual with web development the 'flow of information' 
dictates alot in which solution to use.
I like your 'publish to static' concept. It sure does speed things up 
for the end user and lower's system resource uses as the
pages are not built with every view.

I'll keep an eye on http://www.phpblaze.org/ and look forward to 
checking out your initial version.

Cheers.

Jesse Scott wrote:

> Obviously there are tons of ways to create a CMS (just look at how 
> many there are out there!) and I've actually created a couple 
> different solutions myself.  The reason I took the approach I did with 
> this one is that it gives you a lot of flexibility with adding 
> metadata to different elements and reusing those elements it multiple 
> pieces of content.  This approach probably wouldn't work out very well 
> if you needed to pull the content out of the database on every view 
> because there are lots of queries and loops involved in following the 
> list.
>
> With the "publish to static" approach I'm taking with this, pretty 
> much every user-side page that I've done so far renders in under .04 
> seconds on our pretty pitiful development box.  That's using Smarty 
> templates (with Smarty caching turned off) and using the ionCube PHP 
> Accelerator.
>
> The project this example is from is:
>
> http://www.phpblaze.org/
>
> I'm not quite done with the initial version so I haven't finished the 
> website yet.
>
> -Jesse
>
> Rudi Starcevic wrote:
>
>> Jesse,
>>
>> Thanks - that's a good example.
>>
>> Could you also have built you CMS solution without linked lists ?
>> I'm curious to see if the rule 'there's more than one way to the top 
>> of the mountain' applies here as it usualy does.
>>
>> Cheers
>> Rudi.
>>
>> Jesse Scott wrote:
>>
>>> In my current CMS project, I use a linked list concept.  I've never 
>>> read about linked-lists specifically for SQL, so I don't know if 
>>> there are any nuances I missed by applying a basic CS approach to 
>>> it.  Anyway, here are simplified versions of a few of my tables:
>>>
>>> content
>>> ----------
>>> cid            serial
>>> title          varchar(255)
>>> first_element  int4 (FK -> content_elements.element_id)
>>>
>>> content_elements
>>> ------------------
>>> element_id     serial
>>> type           varchar(64) (FK -> element_types.element_type_id)
>>> next_element   int4 (FK -> content_element.element_id)
>>>
>>> Now, in content_elements I also have a few fields that are foreign 
>>> keys to the various tables that actually hold the different element 
>>> types such as paragraphs, images, etc...  I should really write some 
>>> custom triggers to really ensure things end up linked correctly.  
>>> But so far it has been working well.  Whenever content is 
>>> "published" I walk the linked list and build static HTML out of the 
>>> article so that displaying content isn't very database intensive.
>>>
>>> There have been a couple times when I've wished I had made it a 
>>> doubly-linked list, so I'll probably add that in the next version, 
>>> but that's just a convenience thing basically.  Makes it easier to 
>>> move elements around and delete them etc...
>>>
>>> Let me know if I didn't explain this very well, I'd be happy to send 
>>> you the actual database specs and some sample code.
>>>
>>> -Jesse
>>>
>>>
>>> Rudi Starcevic wrote:
>>>
>>>> Hi,
>>>>
>>>> Can anyone give me a real world example of where a 'linked list'
>>>> would be used in PostgreSQL or SQL in general.
>>>> Just been reading up a little on them and am wondering how/when to 
>>>> use them.
>>>>
>>>> Many thanks
>>>> Rudi.
>>>>
>>>> ---------------------------(end of 
>>>> broadcast)---------------------------
>>>> TIP 9: the planner will ignore your desire to choose an index scan 
>>>> if your
>>>>      joining column's datatypes do not match
>>>>
>>>>  
>>>>
>>>
>>
>>
>>
>




pgsql-sql by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: change a field
Next
From: "A.Bhuvaneswaran"
Date:
Subject: Re: change a field