Query performance boost


#1

I’ve a table with structure like this:

id: int
field1: varchar(255)
field2: int(11)
field3: text
field4: text
field5: varchar(255)
field6: varchar(255)

assume that this table contains massive contents on field 3 and 4
So any way that I will be able to access this table quicker than my
current query?

And this is the way I’m access this table:

Table.find(:all, :include=> “relate_table”)

please give me some hint (and I need all fields to display on page)


#2

Ukrit H. wrote:

I’ve a table with structure like this:

id: int
field1: varchar(255)
field2: int(11)
field3: text
field4: text
field5: varchar(255)
field6: varchar(255)

assume that this table contains massive contents on field 3 and 4
So any way that I will be able to access this table quicker than my
current query?

And this is the way I’m access this table:

Table.find(:all, :include=> “relate_table”)

please give me some hint (and I need all fields to display on page)

would anyone mind giving some idea?


#3

Assuming you’re using MySQL these might help you.

http://dev.mysql.com/doc/refman/5.1/en/static-format.html
http://dev.mysql.com/doc/refman/5.1/en/dynamic-format.html


Shiv N Gautam

On Fri, Jan 16, 2009 at 2:17 PM, Ukrit H. <
removed_email_address@domain.invalid> wrote:

field6: varchar(255)
please give me some hint (and I need all fields to display on page)

would anyone mind giving some idea?

Posted via http://www.ruby-forum.com/.

Robert Orben - “To err is human - and to blame it on a computer is even
more so.”


#4

Quoting Ukrit H. removed_email_address@domain.invalid:

assume that this table contains massive contents on field 3 and 4
So any way that I will be able to access this table quicker than my
current query?

And this is the way I’m access this table:

Table.find(:all, :include=> “relate_table”)

Table.connection.select_row(“SELECT * FROM table, relate_table
WHERE table.relate_table_id = relate_table.id”)

Returns an array of strings. This is from memory. The function name
may not be quite correct.

HTH,
Jeffrey


#5

On Thu, Jan 15, 2009 at 8:09 PM, Ukrit H.
removed_email_address@domain.invalid wrote:

assume that this table contains massive contents on field 3 and 4
So any way that I will be able to access this table quicker than my
current query?

And this is the way I’m access this table:

Table.find(:all, :include=> “relate_table”)

please give me some hint (and I need all fields to display on page)

You can use :select in your calls to find to select specific fields to
retrieve data for. Here is a quick writeup on it.

Good luck!

Cheers,
Robby


Robby R.
Chief Evangelist, Partner

PLANET ARGON, LLC
design // development // hosting w/Ruby on Rails


http://www.robbyonrails.com/
aim: planetargon

+1 503 445 2457
+1 877 55 ARGON [toll free]
+1 815 642 4068 [fax]