0

Background

My site is very large already and its only in its infancy. The content title table has 14000+ values in it. To make sure there are no duplicate values in the table I am creating a view that will display all of the institutions with the same title and the same address. At the current time I am just checking title to keep things simple.

Problem

The sizeable amount of data means that to return values is very slow.

Logic and Code

I am creating a view with address, type & title in a table with the requirement that the only institutes that come in have the same name.

My thoughts were that on every row I would take the $row->node_title and put it into a query against every other value in title like

$query= db_query("SELECT node.title 
                  FROM node 
                  WHERE ((node.status = '1') 
                  AND (node.type IN ('institution')) 
                  AND (node.title=".$row->node_title."))")->rowCount();

This should return a number, if the number is 1 then i want to exclude it with the following statement

if($query == 1){ 
  return true
}

Question

This is taking so long to calculate I thought there must be a faster way. I'm not even sure if the result from this is returning correctly because I've been waiting so long, Is there a faster way to get a list of all the duplicate values in a table with drupal?

1 Answer 1

1

Try using Remove Duplicates

This module helps the administrator to easily remove duplicate nodes according to one of the node fields.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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