[rt-devel] shredding users

Alex Vandiver alexmv at bestpractical.com
Thu Jul 17 11:43:01 EDT 2014


On 07/17/2014 09:23 AM, Wallace Reis wrote:
> On Jul 17, 2014, at 10:07, Christian Loos <cloos at netcologne.de> 
> wrote:
>> Hi,
>> 
>> shredding users, the longest database part was this query:
>> SELECT main.* FROM Attachments main  WHERE (main.Creator = '123')
>> ORDER BY main.id ASC
>> 
>> Beside maybe mentioning an index on Attachments.Creator for 
>> shredder and maybe omit the sorting, wouldn't it be better to 
>> "SELECT main.id FROM Attachments ..." which wouldn't send the 
>> Content column?
> 
> Hi,
> 
> It depends on the RT instance you have. Have you analysed the
> query plan of original query? How about the proposed solutions?
> Without looking at that, it sounds like that the first two things
> you suggested about the index and sorting would provide way more
> gain than just removing columns from the retrieval list if it’s for
> a RT instance where attachments are basically small (about a few
> hundreds of KB).

There's no reason to _not_ limit the set of columns down.  The index
will probably help the most, I agree -- removing the sort is unlikely
to make much difference, as sorting by the primary key is pretty cheap
in most databases.
 - Alex


More information about the rt-devel mailing list