# Indexing on string URLs. How efficient?

**URL:** <https://www.ruby-forum.com/t/indexing-on-string-urls-how-efficient/143201>\
**Category:** Rails\
**Created:** [July 16, 2008, 8:57am UTC](https://www.ruby-forum.com/t/indexing-on-string-urls-how-efficient/143201 "2008-07-16T08:57:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![arpit](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e99b99/32.png) [@arpit](https://www.ruby-forum.com/u/arpit)\
**Post date:** [July 16, 2008, 8:57am UTC](https://www.ruby-forum.com/t/indexing-on-string-urls-how-efficient/143201/1 "2008-07-16T08:57:44Z")

</div>

What is the best way to store permalinks/slugs when you have the  
parent-child model like Radiant? In radiant each page can have many  
child  
pages and each page has slug which is unique in the scope of parent.  
Now,  
every time a create request is made. it finds all associated ancestor  
pages  
and there children.  
Eg.:  
If the request is [http://mysite.com/a/b/c/d/e/f](http://mysite.com/a/b/c/d/e/f) , it will find all the  
pages from a-f(around 12 queries for finding the page and finding its  
children), which is quite unnecessary if you store “a/b/c/d/e/f” itself  
in  
the slug. Actually, I have a pretty big table. Is it efficient to  
store  
this complete url and index it and search in table on the basis of this  
slug  
rather than querying for all the parent pages/other-entities ??

–  
Arpit J.  
Senior Undergraduate Student  
Department of Computer Science & Engineering  
Indian Institute of Technology, Kharagpur, India.  
Web: [http://www.arpitjain.com](http://www.arpitjain.com)
