sorry not getting what changes i have to follow, currently clearly data missing
Hi @krishnasahu2016,
Regarding:
create index indx on test(all array grp for grp in grps end) where type=âtest1â tot indexed dcouments 290K
and
create index indx on test(all array grp for grp in grps end,grps,users) where type=âtest1â 254K documents
Can you check if the documents are being skipped as entire array size is exceeding the limit? The error message should be logged in indexer.log and would be like âarray item too long. Skipped.â.
Thanks,
Prathibha
Hi @geraldss,
Sorry for late reply
Index is
Definition: CREATE PRIMARY INDEX #primary ON pks_mysql_import USING GSI
Document is like as
id
google
ĐĄontent
{
âclicksâ: 0,
âipâ: â10.49.149.147â,
âkeywordâ: âSampleâ,
âtimestampâ: â2016-09-28 14:28:37â,
âtitleâ: âhttp://google.comâ,
âuserâ: âadminâ
âurlâ: âhttp://google.comâ
}
My query is âSELECT * FROM $bucket
LIMIT $perpage OFFSET $offsetâ but I want to make it like as
âSELECT * FROM $bucket
ORDER BY timestamp ASC LIMIT $perpage OFFSET $offsetâ but this is taking too long time.
Kindly consider my database is approx 90-100 Million
Hi, you cannot use primary index for performance.
Hi all,
i have evaluated same data set using some full text search engines wow taking 1/4th memory and disk space with data in sub-milliseconds with sorting.
Please improve order by and index performance also space usage for effectively use couchbase in production
Thx @geraldss , So what I should do in this case ? As I have already shared my query
SELECT * FROM $bucket ORDER BY timestamp ASC LIMIT $perpage OFFSET $offset. Should I create one more index ? if Yes then on which column to make it effective ? Is column name timestamp ?
How come you donât have a WHERE clause?
I want to show all records for admin. so I am not using where clause.
Ok.
CREATE INDEX idx1 ON mybucket( timestamp );
Thx geraldss I try this. I just wan to know one more thing is there substitution of where 1=1 in CB like
Select * from mybucket where 1=1. (Mysql Query). Basically we use it in programing .To add condition dynamically
How long is the query taking now?
Hi geraldss, itâs not working.
select * from my_bucket LIMIT 5 OFFSET 15; ( âexecutionTimeâ: â36.261034msâ)
select * from my_bucket ORDER BY timestamp ASC LIMIT 5 OFFSET 15; (âexecutionTimeâ: â3.027551406sâ).
While there is only for 46K records. Consider, as suggested I have already created index on timestamp.
Please always post the EXPLAIN as well.
Hi geraldss . Any thing is missing ?
Yes, the EXPLAIN is missing. Please post.
Dear Geraldss,
I want to show all records on single page for admin. For this purpose I am using ORDER BY .
SELECT * FROM $bucket ORDER BY timestamp ASC LIMIT $perpage OFFSET $offset
Above query is taking too much time. This is origin of my question .As suggested I have created index CREATE INDEX idx1 ON mybucket( timestamp ); But still it did not put any impact on execution time.
If I am using query without Order by itâs taking 36.2 ms
select * from my_bucket LIMIT 5 OFFSET 15; ( âexecutionTimeâ: â36.261034msâ).
If I ma using Order BY it is taking 3 sec
select * from my_bucket ORDER BY timestamp ASC LIMIT 5 OFFSET 15; (âexecutionTimeâ: â3.027551406sâ).
while number of records in bucket are only 46000.
Sorry, I missed this earlier. Here you go.
SELECT * FROM my_bucket
WHERE timestamp IS NOT MISSING
ORDER BY timestamp ASC LIMIT 5 OFFSET;
Sorry Geraldss,
As suggested I executed following query
select * from my_bucket WHERE timestamp IS NOT MISSING ORDER BY timestamp ASC LIMIT 5 OFFSET 15;
It took more than 4 sec. So no Impact
Please post the EXPLAIN for this.
yes, I tried but still itâs taking lot of time. can i share plain text of EXPLAIN