Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I am working with a 300K records dataset and I am having some performance issues. I try creating a node for each of the records on the dataset, but even the simple path translation query is taking forever (over 50ms to execute) to get the node ID from the page and the rest of the queries on the page make it insanely slow to load a single page. The server has all the capacity it might need and it even has memcached working, PHP-FPM, NGINX, etc.

I decided to have each page coming from that dataset as simple as possible to avoid having to load all those objects and so on. The question comes when I want to use the url:

http://www.example.com/item-ABBC

ABBC is the argument that will hit the database to perform a search, but I can figure out how to accomplish this with the hook_menu:

function mymodule_menu() {
    $items['item-%'] = array(
      'page callback' => 'mymodule_abbc_view',
      'type' => MENU_CALLBACK,
    );
    return $items;
}

I am trying to avoid hitting the path table as much as possible that is why I wanted to use the MENU_CALLBACK instead of a regular menu item.

Is this possible at all?

share|improve this question

1 Answer 1

The way Drupal works out of the box, you need to separate your arguments with /. So your URL should be 'item/%'.

share|improve this answer
    
So I will have to use a path to go from item/% to item-% –  redhatlab Jan 28 at 13:14
    
That's an option, but what will you do if user go directly to item-%? –  Maarten De Block Jan 28 at 15:36

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.